arize-phoenix 10.1.0__py3-none-any.whl → 10.2.1__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.
- {arize_phoenix-10.1.0.dist-info → arize_phoenix-10.2.1.dist-info}/METADATA +2 -2
- {arize_phoenix-10.1.0.dist-info → arize_phoenix-10.2.1.dist-info}/RECORD +19 -19
- phoenix/db/insertion/dataset.py +2 -1
- phoenix/db/types/model_provider.py +1 -0
- phoenix/server/api/helpers/playground_clients.py +29 -0
- phoenix/server/api/helpers/prompts/models.py +20 -0
- phoenix/server/api/routers/v1/datasets.py +8 -2
- phoenix/server/api/types/GenerativeProvider.py +5 -0
- phoenix/server/static/.vite/manifest.json +9 -9
- phoenix/server/static/assets/{components-BHJEWQsc.js → components-ClD3sHta.js} +164 -164
- phoenix/server/static/assets/{index-CAt4FOOX.js → index-CXawXHw0.js} +1 -1
- phoenix/server/static/assets/{pages-kpw8RDmo.js → pages-BFtNRfTL.js} +122 -122
- phoenix/session/evaluation.py +6 -1
- phoenix/trace/dsl/helpers.py +90 -1
- phoenix/version.py +1 -1
- {arize_phoenix-10.1.0.dist-info → arize_phoenix-10.2.1.dist-info}/WHEEL +0 -0
- {arize_phoenix-10.1.0.dist-info → arize_phoenix-10.2.1.dist-info}/entry_points.txt +0 -0
- {arize_phoenix-10.1.0.dist-info → arize_phoenix-10.2.1.dist-info}/licenses/IP_NOTICE +0 -0
- {arize_phoenix-10.1.0.dist-info → arize_phoenix-10.2.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as R,bk as ve,bl as ze,bm as Be,bn as Nl,D as Gl,r as m,j as e,u as Cl,aW as ua,l as o,Q as J,R as sn,o as x,aG as Ke,aH as ln,aJ as Te,aK as W,T as G,U as Z,bo as Me,q as je,ae as Ve,bp as op,ai as H,V as Se,aE as fa,F,aj as Ye,ab as Xe,bq as sp,br as dp,bs as cp,bt as up,aB as ue,af as ti,bu as nr,bv as Ol,bw as Ce,aM as ce,bx as Oe,by as mp,aZ as Tn,bz as gp,aN as pp,bA as yp,J as ar,b0 as Ba,aY as Re,aX as Rn,bB as Pn,bC as gn,m as lo,$ as fp,S as lr,G as tr,aU as to,I as hp,X as kp,bD as bp,bE as _t,bF as At,bG as nl,b2 as Ql,b1 as Bl,t as Fl,b7 as ii,aO as Sp,bH as vp,bI as ir,bJ as Cp,bK as Fp,bL as Kp,bM as Tp,bN as Pp,bO as xp,bP as Ip,bQ as Dp,bR as Lp,bS as pl,E as _p,bT as Ap,bU as Al,g as io,bV as wp,aD as ri,bW as ro,bX as oo,bY as Rp,ak as Ep,bZ as Mp,ag as Vp,ah as zp,b_ as Np,n as $p}from"./vendor-DOUbLVp5.js";import{e as te,t as ha,D as re,C as B,c as Ne,a as dn,T as Ie,s as zn,r as oi,b as si,L as Wl,v as Jl,w as so,m as di,P as Kl,d as Hn,E as Zl,o as ka,p as qa,f as ba,q as Xl,x as jp,y as Yl,z as Op,A as Qp,B as Bp,G as ci,H as ui,u as qp,J as Up}from"./vendor-arizeai-DHqMQzfV.js";import{s as Hp,l as Gp,j as mi,a as Qe,i as gi,b as Wp,c as Jp,d as ma,e as En,f as co,D as uo,g as oa,h as cl,C as $l,k as Zp,m as Pe,T as yn,n as Xp,o as pi,p as rr,q as Yp,r as or,t as ey,u as ny,v as ay,_ as v,G as et,w as b,x as C,y as E,I as _,E as Sa,z as Ue,A as X,R as he,B as ke,F as me,H as sr,J as dr,N as sa,K as He,P as da,L as pn,M as kn,O as Ge,Q as We,S as tn,U as Mn,V as Ua,W as cn,X as Cn,Y as De,Z as ae,$ as ge,a0 as en,a1 as Tl,a2 as mo,a3 as we,a4 as go,a5 as Ee,a6 as _e,a7 as yi,a8 as Nn,a9 as po,aa as nn,ab as ne,ac as oe,ad as an,ae as yo,af as ql,ag as qe,ah as Gn,ai as ly,aj as ty,ak as fo,al as Ut,am as fi,an as nt,ao as iy,ap as ry,aq as Ht,ar as wl,as as de,at as ho,au as Fn,av as at,aw as $n,ax as Wn,ay as ko,az as bo,aA as oy,aB as sy,aC as Kn,aD as dy,aE as Dn,aF as cy,aG as So,aH as lt,aI as wa,aJ as hi,aK as ki,aL as uy,aM as vo,aN as my,aO as gy,aP as py,aQ as yy,aR as fy,aS as hy,aT as ky,aU as Fe,aV as by,aW as Sy,aX as yl,aY as vy,aZ as pe,a_ as Gt,a$ as ye,b0 as fe,b1 as fn,b2 as Cy,b3 as Fy,b4 as Ky,b5 as bn,b6 as Ty,b7 as Py,b8 as xy,b9 as tt,ba as it,bb as Co,bc as Iy,bd as Dy,be as Ly,bf as Pl,bg as _y,bh as Fo,bi as Ay,bj as bi,bk as xn,bl as wy,bm as Ry,bn as Ey,bo as Bn,bp as on,bq as Ko,br as $e,bs as To,bt as qn,bu as rt,bv as Ha,bw as Po,bx as Sn,by as Si,bz as xa,bA as My,bB as za,bC as Vy,bD as zy,bE as vi,bF as ot,bG as Jn,bH as va,bI as xo,bJ as Io,bK as Wt,bL as Oa,bM as un,bN as st,bO as Do,bP as dt,bQ as Zn,bR as Lo,bS as ct,bT as Ny,bU as _o,bV as Ao,bW as cr,bX as ur,bY as $y,bZ as fl,b_ as Jt,b$ as ut,c0 as jy,c1 as Oy,c2 as Ga,c3 as Qy,c4 as By,c5 as hl,c6 as kl,c7 as bl,c8 as mt,c9 as Ci,ca as wo,cb as qy,cc as Sl,cd as Ro,ce as gt,cf as pt,cg as Xn,ch as Uy,ci as Hy,cj as vn,ck as Vn,cl as Da,cm as Fi,cn as Eo,co as Ki,cp as Gy,cq as Wy,cr as Jy,cs as Zy,ct as Xy,cu as Yy,cv as ef,cw as Ti,cx as Mo,cy as Vo,cz as zo,cA as No,cB as Je,cC as $o,cD as jo,cE as Zt,cF as Pi,cG as xi,cH as nf,cI as af,cJ as lf,cK as Ii,cL as tf,cM as rf,cN as yt,cO as of,cP as Rl,cQ as sf,cR as df,cS as Oo,cT as cf,cU as uf,cV as mf,cW as gf,cX as pf,cY as yf,cZ as ff,c_ as hf,c$ as kf,d0 as Qo,d1 as mr,d2 as bf,d3 as jn,d4 as Yn,d5 as Di,d6 as Bo,d7 as qo,d8 as gr,d9 as pr,da as Sf,db as vf,dc as Y,dd as Uo,de as ft,df as ht,dg as Wa,dh as Ho,di as Ja,dj as Za,dk as Go,dl as Cf,dm as Ff,dn as Kf,dp as Tf,dq as Pf,dr as xf,ds as If,dt as La,du as Wo,dv as Df,dw as Lf,dx as yr,dy as _f,dz as Af,dA as wf,dB as Rf,dC as Ef,dD as Mf,dE as Jo,dF as Vf,dG as zf,dH as Nf,dI as $f,dJ as _a,dK as Li,dL as Zo,dM as Na,dN as wt,dO as jf,dP as Of,dQ as _i,dR as kt,dS as Ln,dT as Xt,dU as Xo,dV as Qf,dW as Bf,dX as Yo,dY as es,dZ as qf,d_ as Uf,d$ as ns,e0 as Hf,e1 as Gf,e2 as fr,e3 as Wf,e4 as Jf,e5 as Zf,e6 as Xf,e7 as Yf,e8 as eh,e9 as Rt,ea as as,eb as nh,ec as ah,ed as hr,ee as lh,ef as th,eg as $a,eh as ih,ei as rh,ej as oh,ek as sh,el as dh,em as bt,en as ls,eo as kr,ep as ch,eq as uh,er as mh,es as gh,et as ts,eu as ph,ev as yh,ew as fh,ex as br,ey as Sr}from"./components-BHJEWQsc.js";import{g as Ca,i as Fa,d as hh,E as is,R as Ka,k as Ai,b as kh,p as xl,n as rs}from"./vendor-codemirror-DWdZV1Is.js";import{P as os,C as ss,T as ea,a as ds,R as On,X as na,Y as In,b as aa,B as Aa,c as St,d as Il,A as vl,e as cs,L as us,f as bh}from"./vendor-recharts-BfHdRd1Y.js";const Sh=4,vh="Unable to parse span input messages, expected messages which include a role and content.",Ch="Unable to parse span output messages, expected messages which include a role and content.",Fh="Unable to parse span output expected output.value to be present.",Kh="Unable to parse span attributes, attributes must be valid JSON.",Th="Unable to parse model config, expected llm.model_name to be present.",Ph="Unable to parse model config, expected llm.invocation_parameters JSON string to be present.",xh="Unable to parse invocation parameters response_format, expected llm.invocation_parameters.response_format to be a well formed json object or undefined.",Ih="Unable to parse tools, expected tools to be an array of valid tools.",Dh="Unable to parse prompt template variables, expected prompt template variables to be a valid JSON object string.",vr={AZURE_OPENAI:[],ANTHROPIC:["claude"],OPENAI:["gpt","o1"],GOOGLE:["gemini"]},ca="TOOL_CHOICE",ja="tool_choice",wn="RESPONSE_FORMAT",_n="response_format",Lh=[ca,wn],_h=R.object({tool_call:R.object({id:R.string().optional(),function:R.object({name:R.string(),arguments:R.string()}).partial()}).partial()}).partial(),ms=R.object({[ve.message]:R.object({[ze.role]:R.string(),[ze.content]:R.union([R.string(),R.array(R.record(R.string(),R.unknown()))]).default(""),[ze.contents]:R.array(R.object({message_content:R.record(R.string())})).optional(),[ze.tool_calls]:R.array(_h).optional(),[ze.tool_call_id]:R.string().optional()})}),Ah=R.object({[ve.llm]:R.object({[Be.input_messages]:R.array(ms)})}),wh=R.object({[ve.llm]:R.object({[Be.output_messages]:R.array(ms)})}),Rh=R.object({[ve.output]:R.object({value:R.string()})}),gs=Hp()(R.enum(["user","ai","system","tool"])),Eh=R.object({id:R.number(),role:gs,content:R.string().optional(),toolCallId:R.string().optional(),toolCalls:R.array(Gp).optional()}),Mh=R.array(Eh),ps=R.lazy(()=>R.record(mi)),Vh=ps,ys=R.string().transform((n,a)=>{const{json:l}=Qe(n);if(!gi(l))return a.addIssue({code:R.ZodIssueCode.custom,message:"The invocation parameters must be a valid JSON object"}),R.NEVER;const{success:t,data:i}=Vh.safeParse(l);return t?i:(a.addIssue({code:R.ZodIssueCode.custom,message:"The invocation parameters must be a valid JSON object"}),R.NEVER)}).default("{}"),zh=R.object({[ve.llm]:R.object({[Be.provider]:R.string().optional(),[Be.model_name]:R.string()})}),fs=R.object({[ve.llm]:R.object({[Be.invocation_parameters]:ys})}),Nh=R.object({[ve.llm]:R.object({[Be.invocation_parameters]:ys.pipe(R.object({response_format:ps.optional()}))})}),$h=R.object({url:R.object({full:R.string(),path:R.string().optional()})}),jh=R.string().transform((n,a)=>{const{json:l}=Qe(n);return l==null||!gi(l)?(a.addIssue({code:R.ZodIssueCode.custom,message:"The tool JSON schema must be a valid JSON object"}),R.NEVER):l}).transform((n,a)=>{const{data:l,success:t}=Wp.safeParse(n);return t?l:(a.addIssue({code:R.ZodIssueCode.custom,message:"The tool JSON schema must be a valid tool schema"}),R.NEVER)}),Oh=R.object({[ve.llm]:R.object({[Be.tools]:R.array(R.object({[ve.tool]:R.object({[Nl.json_schema]:jh})}).optional()).optional()}).optional()}).optional(),Qh=R.lazy(()=>R.object({type:R.literal("json_schema"),json_schema:R.object({name:R.string().describe("The name of the schema"),schema:Jp.describe("The schema itself in JSON schema format"),strict:R.literal(!0).describe("The schema must be strict")})})),Bh=Gl(Qh,{removeAdditionalStrategy:"passthrough"}),qh=R.string().transform((n,a)=>{const{json:l}=Qe(n);return ma(l)?Object.entries(l).reduce((i,[r,s])=>{if(typeof s=="string")i[r]=s;else{const{json:d}=En(s);d!=null&&(i[r]=d)}return i},{}):(a.addIssue({code:R.ZodIssueCode.custom,message:"The prompt template variables must be a valid JSON object"}),R.NEVER)}),Uh=R.object({[ve.llm]:R.object({[Be.prompt_template]:R.object({variables:qh}).optional()}).optional()}).optional();function hs(n){return gs.safeParse(n).success}function ia(n){const a=n.toLowerCase();if(hs(a))return a;for(const[l,t]of Object.entries($l))if(t.includes(a))return l;return Zp}function Hh({toolCalls:n,provider:a}){if(n!=null)return n.map(({tool_call:l})=>{var i,r,s,d;if(l==null)return null;let t={};if(((i=l.function)==null?void 0:i.arguments)!=null){const{json:c}=Qe(l.function.arguments);ma(c)&&(t=c)}switch(a){case"OPENAI":case"AZURE_OPENAI":return{id:l.id??"",type:"function",function:{name:((r=l.function)==null?void 0:r.name)??"",arguments:t}};case"ANTHROPIC":return{id:l.id??"",type:"tool_use",name:((s=l.function)==null?void 0:s.name)??"",input:t};case"GOOGLE":return{id:l.id??"",function:{name:((d=l.function)==null?void 0:d.name)??"",arguments:t}};default:Pe()}}).filter(l=>l!=null)}function ks({messages:n,provider:a}){return n.map(({message:l})=>{var t,i;return{id:oa(),role:l.tool_call_id!=null?ia("tool"):ia(l.role),content:Array.isArray(l.contents)?((i=(t=l.contents.find(r=>r.message_content.type==="text"))==null?void 0:t.message_content)==null?void 0:i.text)??void 0:typeof l.content=="string"?l.content:void 0,toolCalls:Hh({provider:a,toolCalls:l.tool_calls}),toolCallId:l.tool_call_id}})}function Gh({provider:n,parsedAttributes:a}){var t;const l=Ah.safeParse(a);if(!l.success)return{messageParsingErrors:[vh],messages:null};if(n==="ANTHROPIC"){const{success:i,data:r}=fs.safeParse(a);if(i){const s=l.data.llm.input_messages,d=(t=r.llm.invocation_parameters)==null?void 0:t.system;typeof d=="string"&&d&&(!s||s[0].message.role!=="system")&&l.data.llm.input_messages.unshift({message:{role:"system",content:d}})}}return{messageParsingErrors:[],messages:ks({provider:n,messages:l.data.llm.input_messages})}}function Wh({provider:n,parsedAttributes:a}){const l=[],t=wh.safeParse(a);if(t.success)return{output:ks({provider:n,messages:t.data.llm.output_messages}),outputParsingErrors:l};l.push(Ch);const i=Rh.safeParse(a);return i.success?{output:i.data.output.value,outputParsingErrors:l}:(l.push(Fh),{output:void 0,outputParsingErrors:l})}function bs(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 Jh(n){for(const a of Object.keys(vr))if(vr[a].some(t=>n.includes(t)))return a;return uo}function Zh(n){const{success:a,data:l}=zh.safeParse(n);if(a){const t=bs(l.llm.provider)||Jh(l.llm.model_name),i=Xh(n);return{modelConfig:{...Object.fromEntries(Object.entries(i).filter(([r,s])=>s!==null)),modelName:l.llm.model_name,provider:t,invocationParameters:[],supportedInvocationParameters:[]},parsingErrors:[]}}return{modelConfig:null,parsingErrors:[Th]}}function Xh(n){const{success:a,data:l}=$h.safeParse(n);if(a)try{const t=new URL(l.url.full);let i=t;if(l.url.path)try{i=new URL(l.url.full.split(l.url.path)[0])}catch{}return{baseUrl:`${i.origin}${i.pathname}`,endpoint:t.origin,apiVersion:t.searchParams.get("api-version")||null}}catch{}return{baseUrl:null,apiVersion:null,endpoint:null}}function Yh(n,a=[]){const{success:l,data:t}=fs.safeParse(n),i=[];return l||i.push(Ph),{invocationParameters:s0((t==null?void 0:t.llm.invocation_parameters)??{},a),parsingErrors:i}}function e0(n){const{success:a,data:l}=Nh.safeParse(n);return a?{responseFormat:l.llm.invocation_parameters.response_format,parsingErrors:[]}:{responseFormat:void 0,parsingErrors:[xh]}}function n0(n){var a;return(((a=n==null?void 0:n.llm)==null?void 0:a.tools)??[]).map(l=>(l==null?void 0:l.tool)==null?null:{id:cl(),definition:l.tool.json_schema}).filter(l=>l!=null)}function a0(n){var t;const{data:a,success:l}=Oh.safeParse(n);return l?((t=a==null?void 0:a.llm)==null?void 0:t.tools)==null?{tools:null,parsingErrors:[]}:{tools:n0(a),parsingErrors:[]}:{tools:null,parsingErrors:[Ih]}}function l0(n){var t;const{success:a,data:l}=Uh.safeParse(n);return a?((t=l==null?void 0:l.llm)==null?void 0:t.prompt_template)==null?{variables:null,parsingErrors:[]}:{variables:l.llm.prompt_template.variables,parsingErrors:[]}:{variables:null,parsingErrors:[Dh]}}function t0(n){const{instance:a,instanceMessages:l}=co(),t={...a,template:{__type:"chat",messages:Object.values(l)}},{json:i,parseError:r}=Qe(n.attributes);if(r)return{playgroundInstance:{...t,spanId:(n==null?void 0:n.id)??null},parsingErrors:[Kh]};const s=n.invocationParameters,d=Zh(i);let{modelConfig:c}=d;const{parsingErrors:p}=d,{messages:y,messageParsingErrors:u}=Gh({provider:(c==null?void 0:c.provider)??t.model.provider,parsedAttributes:i}),{output:g,outputParsingErrors:f}=Wh({provider:(c==null?void 0:c.provider)??t.model.provider,parsedAttributes:i}),{invocationParameters:k,parsingErrors:h}=Yh(i,s),{variables:S,parsingErrors:K}=l0(i),{parsingErrors:P}=e0(i);c=c!=null?{...c,invocationParameters:P.length>0?k.filter(L=>L.invocationName!==_n&&L.canonicalName!==wn):k}:null;const{tools:I,parsingErrors:D}=a0(i),T=y==null?void 0:y.map(L=>({...L,content:L.role==="tool"?wi(L.content):L.content}));return{playgroundInstance:{...t,model:c??t.model,template:T!=null?{__type:"chat",messages:T}:t.template,output:g,spanId:n.id,tools:I??t.tools},playgroundInput:S!=null?{variablesValueCache:S}:void 0,parsingErrors:[...u,...f,...p,...D,...h,...P,...K]}}const i0=n=>Mh.safeParse(n).success,Ss=({instance:n,templateFormat:a})=>{if(a==yn.NONE)return[];const l=new Set,t=n.template.__type,i=Xp(a);switch(t){case"chat":{n.template.messages.forEach(r=>{(r.content==null?[]:i.extractVariables(r.content)).forEach(d=>{l.add(d)})});break}case"text_completion":{i.extractVariables(n.template.prompt).forEach(s=>{l.add(s)});break}default:Pe()}return Array.from(l)},r0=({instances:n,templateFormat:a})=>a==yn.NONE?[]:Array.from(new Set(n.flatMap(l=>Ss({instance:l,templateFormat:a})))),vs=({instances:n,templateFormat:a,input:l})=>{if(a==yn.NONE)return{variablesMap:{},variableKeys:[]};const t=r0({instances:n,templateFormat:a}),i=l.variablesValueCache??{};return{variablesMap:t.reduce((s,d)=>(s[d]=i[d]||"",s),{}),variableKeys:t}};function ga(n,a){return n.invocationName===a.invocationName||n.canonicalName!=null&&a.canonicalName!=null&&n.canonicalName===a.canonicalName}const o0=(n,a)=>n.filter(l=>a.some(t=>ga(t,l))).map(l=>{var t;return{...l,invocationName:((t=a.find(i=>ga(i,l)))==null?void 0:t.invocationName)??l.invocationName}}),Xa=n=>n.replace(/_([a-z])/g,(a,l)=>l.toUpperCase()),s0=(n,a)=>Object.entries(n).map(([l,t])=>{const i=a.find(r=>r.canonicalName&&r.canonicalName.toLowerCase()===l.toLowerCase()||r.invocationName&&r.invocationName.toLowerCase()===l.toLowerCase());return i==null||i.invocationInputField==null||i.invocationName==null?null:{canonicalName:i.canonicalName,invocationName:i.invocationName,[Xa(i.invocationInputField)]:t}}).filter(l=>l!=null),Cs=n=>{const{provider:a,validatedToolDefinition:l}=ny(n.definition);switch(a){case"OPENAI":case"AZURE_OPENAI":return l.function.name;case"ANTHROPIC":return l.name;case"UNKNOWN":return null;default:Pe()}},d0=({provider:n,toolNumber:a})=>{switch(n){case"OPENAI":case"AZURE_OPENAI":return{id:cl(),definition:or(a)};case"ANTHROPIC":return{id:cl(),definition:ey(a)};case"GOOGLE":return{id:cl(),definition:or(a)};default:Pe()}},c0=n=>{switch(n){case"OPENAI":case"AZURE_OPENAI":return rr();case"ANTHROPIC":return Yp();case"GOOGLE":return rr();default:Pe()}};function u0(n){return{content:n.content,role:m0(n.role),toolCalls:n.toolCalls,toolCallId:n.toolCallId}}function m0(n){switch(n){case"system":return"SYSTEM";case"user":return"USER";case"tool":return"TOOL";case"ai":return"AI";default:Pe()}}const Fs=({playgroundStore:n,instanceId:a,credentials:l})=>{var u;const{instances:t,allInstanceMessages:i}=n.getState(),r=t.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 s=r.template.messageIds.map(g=>i[g]).filter(g=>g!=null),d=r.model.supportedInvocationParameters;let c=[...r.model.invocationParameters];const p=pi({toolChoice:r.toolChoice,targetProvider:r.model.provider});r.tools.length>0?(c=c.filter(g=>g.invocationName!==ja&&g.canonicalName!==ca),c.push({canonicalName:ca,invocationName:ja,valueJson:p})):c=c.filter(g=>g.invocationName!==ja&&g.canonicalName!==ca),c=d.length?o0(c,d):c;const y=r.model.provider==="AZURE_OPENAI"?{endpoint:r.model.endpoint,apiVersion:r.model.apiVersion}:{};return{messages:s.map(u0),model:{providerKey:r.model.provider,name:r.model.modelName||"",baseUrl:r.model.baseUrl,...y},invocationParameters:Ts(c,r.model.provider,r.model.modelName),tools:r.tools.length?r.tools.map(g=>g.definition):void 0,apiKey:l[r.model.provider]||null,promptName:(u=r.prompt)==null?void 0:u.name}},vt=(n,a)=>{if(n.template.__type==="chat"){const{messageIds:l,...t}=n.template;return{...n,template:{...t,messages:n.template.messageIds.map(i=>a[i])}}}return n},g0=({playgroundStore:n,instanceId:a,credentials:l})=>{const t=Fs({playgroundStore:n,instanceId:a,credentials:l}),{instances:i,templateFormat:r,input:s,allInstanceMessages:d}=n.getState(),c=i.map(y=>vt(y,d)),{variablesMap:p}=vs({instances:c,input:s,templateFormat:r});return{...t,template:{variables:p,format:r}}},Cr=({playgroundStore:n,instanceId:a,credentials:l,datasetId:t})=>({...Fs({playgroundStore:n,instanceId:a,credentials:l}),templateFormat:n.getState().templateFormat,datasetId:t});function wi(n){if(typeof n=="string"){const a=n.startsWith('"{')||n.startsWith('"[')||n.startsWith('"\\"');try{if(a){const t=JSON.parse(n),i=typeof t=="string"?JSON.parse(t):t;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 Ks(n,a){return a.filter(l=>l.required).every(l=>n.some(t=>ga(t,l)))}const p0=n=>{for(const[a,l]of Object.entries(n))if(a.endsWith("DefaultValue")&&l!=null)return n[a]};function BK(n,a){const l=new Map(n.map(t=>[t.invocationName,t]));return a.forEach(t=>{var c;const i=t.invocationName,r=p0(t),s=Xa(t.invocationInputField||"");if(!t.invocationName||!t.invocationInputField||!i||r==null||((c=l.get(i))==null?void 0:c[s])!=null)return;const d={canonicalName:t.canonicalName,invocationName:t.invocationName,[s]:r};l.set(i,d)}),Array.from(l.values())}const y0=R.object({type:R.literal("enabled")}).passthrough(),f0=R.object({type:R.enum(["any","tool"])}).passthrough(),h0=(n,a)=>{if(!a)return n;const l=n.some(t=>t.canonicalName==="ANTHROPIC_EXTENDED_THINKING"&&t.valueJson&&y0.safeParse(t.valueJson).success);return n.filter(t=>{if(t.canonicalName==="ANTHROPIC_EXTENDED_THINKING"&&!t.valueJson)return!1;if(l){if(t.canonicalName==="TEMPERATURE"||t.canonicalName==="TOP_P")return!1;if(t.canonicalName===ca)return!f0.safeParse(t.valueJson).success}return!0})},Ts=(n,a,l)=>a==="ANTHROPIC"?h0(n,l):n,Ps=m.createContext(null);function qK({children:n,...a}){const[l]=m.useState(()=>ay(a));return e(Ps.Provider,{value:l,children:n})}function Qa(n,a){const l=m.useContext(Ps);if(!l)throw new Error("Missing CredentialsContext.Provider in the tree");return Cl(l,n,a)}const xs="arize-phoenix-feature-flags",Et={dashboards:!1};function k0(){const n=localStorage.getItem(xs);if(!n)return Et;try{const a=JSON.parse(n);return Object.assign({},Et,a)}catch{return Et}}const Is=m.createContext(null);function Ds(){const n=sn.useContext(Is);if(n===null)throw new Error("useFeatureFlags must be used within a FeatureFlagsProvider");return n}function b0(n){const{featureFlags:a}=Ds();return a[n]}function UK(n){const[a,l]=m.useState(k0()),t=i=>{localStorage.setItem(xs,JSON.stringify(i)),l(i)};return e(Is.Provider,{value:{featureFlags:a,setFeatureFlags:t},children:e(S0,{children:n.children})})}function S0(n){const{children:a}=n,{featureFlags:l,setFeatureFlags:t}=Ds(),[i,r]=m.useState(!1);return ua("ctrl+shift+f",()=>r(!0)),o(J,{children:[a,e(re,{type:"modal",isDismissable:!0,onDismiss:()=>r(!1),children:i&&e(te,{title:"Feature Flags",children:e(v,{height:"size-1000",padding:"size-100",children:Object.keys(l).map(s=>e(ha,{isSelected:l[s],onChange:d=>t({...l,[s]:d}),children:s},s))})})})]})}const Ls=m.createContext(null);function v0(){const n=m.useContext(Ls);if(n===null)throw new Error("useFunctionality must be used within a FunctionalityProvider");return n}function HK(n){return e(Ls.Provider,{value:{authenticationEnabled:window.Config.authenticationEnabled},children:n.children})}const _s={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};_s.hash="0168d590171b96e7a2e41449a41754be";function C0({query:n}){const[a,l]=m.useState(null),t=Qa(y=>y),i=Qa(y=>y.setCredential),r=x.useFragment(_s,n),s=m.useMemo(()=>[...r.modelProviders],[r]),d=m.useMemo(()=>[{header:"Name",accessorKey:"name",cell:({row:y})=>o(b,{direction:"row",alignItems:"center",gap:"size-100",children:[e(et,{provider:y.original.key,height:18}),y.original.name]})},{header:"Environment Variable",accessorKey:"apiKeyEnvVar",cell:({row:y})=>e(C,{children:y.original.apiKeyEnvVar})},{header:"configuration",accessorKey:"apiKeySet",cell:({row:y})=>y.original.dependenciesInstalled?t[y.original.key]?e(C,{color:"success",children:"local"}):y.original.apiKeySet?e(C,{color:"success",children:"configured on the server"}):e(C,{color:"text-700",children:"not configured"}):e(C,{color:"warning",children:"missing dependencies"})},{header:"",accessorKey:"id",cell:({row:y})=>e(b,{direction:"row",justifyContent:"end",gap:"size-100",width:"100%",children:e(E,{size:"S",leadingVisual:e(_,{svg:e(Sa,{})}),onPress:()=>{l(y.original)}})})}],[t]),c=Ke({columns:d,data:s,getCoreRowModel:Te(),getSortedRowModel:ln()}),p=c.getRowModel().rows;return o(B,{title:"AI Providers",bodyStyle:{padding:0},variant:"compact",children:[o("table",{css:Ue,children:[e("thead",{children:c.getHeaderGroups().map(y=>e("tr",{children:y.headers.map(u=>e("th",{colSpan:u.colSpan,children:u.isPlaceholder?null:e("div",{children:W(u.column.columnDef.header,u.getContext())})},u.id))},y.id))}),e("tbody",{children:p.map(y=>e("tr",{children:y.getVisibleCells().map(u=>e("td",{children:W(u.column.columnDef.cell,u.getContext())},u.id))},y.id))})]}),e(re,{type:"modal",isDismissable:!0,onDismiss:()=>l(null),children:a&&o(te,{title:`Set ${a.name} API Key`,size:"S",children:[o(v,{padding:"size-200",children:[e(v,{paddingBottom:"size-100",children:o(C,{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."]})}),o(X,{onChange:y=>{i({provider:a.key,value:y})},value:t[a.key],type:"password",children:[e(G,{children:`${a.name} API Key`}),e(Z,{placeholder:`e.g. ${a.apiKeyEnvVar}`}),e(C,{slot:"description",children:"The API key will be stored locally in your browser"})]})]}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopWidth:"thin",borderColor:"light",children:e(b,{direction:"row",justifyContent:"end",gap:"size-100",children:e(E,{variant:"primary",size:"S",onPress:()=>{l(null)},children:"Set API Key"})})})]})})]})}function GK(){const n=Me();return je(n),e(C0,{query:n})}const As={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{B as R,bk as ve,bl as ze,bm as Be,bn as Nl,D as Gl,r as m,j as e,u as Cl,aW as ua,l as o,Q as J,R as sn,o as x,aG as Ke,aH as ln,aJ as Te,aK as W,T as G,U as Z,bo as Me,q as je,ae as Ve,bp as op,ai as H,V as Se,aE as fa,F,aj as Ye,ab as Ue,bq as sp,br as dp,bs as cp,bt as up,aB as ue,af as ti,bu as nr,bv as Ol,bw as Ce,aM as ce,bx as Oe,by as mp,aZ as Tn,bz as gp,aN as pp,bA as yp,J as ar,b0 as Ba,aY as Re,aX as Rn,bB as Pn,bC as mn,m as lo,$ as fp,S as lr,G as tr,aU as to,I as hp,X as kp,bD as bp,bE as _t,bF as At,bG as nl,b2 as Ql,b1 as Bl,t as Fl,b7 as ii,aO as Sp,bH as vp,bI as ir,bJ as Cp,bK as Fp,bL as Kp,bM as Tp,bN as Pp,bO as xp,bP as Ip,bQ as Dp,bR as Lp,bS as pl,E as _p,bT as Ap,bU as Al,g as io,bV as wp,aD as ri,bW as ro,bX as oo,bY as Rp,ak as Ep,bZ as Mp,ag as Vp,ah as zp,b_ as Np,n as $p}from"./vendor-DOUbLVp5.js";import{e as te,t as ha,D as re,C as B,c as Ne,a as gn,T as Le,s as zn,r as oi,b as si,L as Wl,v as Jl,w as so,m as di,P as Kl,d as Hn,E as Zl,o as ka,p as qa,f as ba,q as Xl,x as jp,y as Yl,z as Op,A as Qp,B as Bp,G as ci,H as ui,u as qp,J as Up}from"./vendor-arizeai-DHqMQzfV.js";import{s as Hp,l as Gp,j as mi,a as Qe,i as gi,b as Wp,c as Jp,d as ma,e as En,f as co,D as uo,g as oa,h as cl,C as $l,k as Zp,m as Pe,T as fn,n as Xp,o as pi,p as rr,q as Yp,r as or,t as ey,u as ny,v as ay,_ as v,G as et,w as b,x as C,y as E,I as _,E as Sa,z as He,A as X,R as he,B as ke,F as me,H as sr,J as dr,N as sa,K as Ge,P as da,L as pn,M as yn,O as We,Q as Je,S as tn,U as Mn,V as Ua,W as dn,X as Cn,Y as Ie,Z as ae,$ as ge,a0 as en,a1 as Tl,a2 as mo,a3 as we,a4 as go,a5 as Ee,a6 as _e,a7 as yi,a8 as Nn,a9 as po,aa as nn,ab as ne,ac as oe,ad as an,ae as yo,af as ql,ag as qe,ah as Gn,ai as ly,aj as ty,ak as fo,al as Ut,am as fi,an as nt,ao as iy,ap as ry,aq as Ht,ar as wl,as as de,at as ho,au as Fn,av as at,aw as $n,ax as Wn,ay as ko,az as bo,aA as oy,aB as sy,aC as Kn,aD as dy,aE as Dn,aF as cy,aG as So,aH as lt,aI as wa,aJ as hi,aK as ki,aL as uy,aM as vo,aN as my,aO as gy,aP as py,aQ as yy,aR as fy,aS as hy,aT as ky,aU as Fe,aV as by,aW as Sy,aX as yl,aY as vy,aZ as pe,a_ as Gt,a$ as ye,b0 as fe,b1 as hn,b2 as Cy,b3 as Fy,b4 as Ky,b5 as bn,b6 as Ty,b7 as Py,b8 as xy,b9 as tt,ba as it,bb as Co,bc as Iy,bd as Dy,be as Ly,bf as Pl,bg as _y,bh as Fo,bi as Ay,bj as bi,bk as xn,bl as wy,bm as Ry,bn as Ey,bo as Bn,bp as on,bq as Ko,br as $e,bs as To,bt as qn,bu as rt,bv as Ha,bw as Po,bx as Sn,by as Si,bz as xa,bA as My,bB as za,bC as Vy,bD as zy,bE as vi,bF as ot,bG as Jn,bH as va,bI as xo,bJ as Io,bK as Wt,bL as Oa,bM as cn,bN as st,bO as Do,bP as dt,bQ as Zn,bR as Lo,bS as ct,bT as Ny,bU as _o,bV as Ao,bW as cr,bX as ur,bY as $y,bZ as fl,b_ as Jt,b$ as ut,c0 as jy,c1 as Oy,c2 as Ga,c3 as Qy,c4 as By,c5 as hl,c6 as kl,c7 as bl,c8 as mt,c9 as Ci,ca as wo,cb as qy,cc as Sl,cd as Ro,ce as gt,cf as pt,cg as Xn,ch as Uy,ci as Hy,cj as vn,ck as Vn,cl as Da,cm as Fi,cn as Eo,co as Ki,cp as Gy,cq as Wy,cr as Jy,cs as Zy,ct as Xy,cu as Yy,cv as ef,cw as Ti,cx as Mo,cy as Vo,cz as zo,cA as No,cB as Ze,cC as $o,cD as jo,cE as Zt,cF as Pi,cG as xi,cH as nf,cI as af,cJ as lf,cK as Ii,cL as tf,cM as rf,cN as yt,cO as of,cP as Rl,cQ as sf,cR as df,cS as Oo,cT as cf,cU as uf,cV as mf,cW as gf,cX as pf,cY as yf,cZ as ff,c_ as hf,c$ as kf,d0 as Qo,d1 as mr,d2 as bf,d3 as jn,d4 as Yn,d5 as Di,d6 as Bo,d7 as qo,d8 as gr,d9 as pr,da as Sf,db as vf,dc as Y,dd as Uo,de as ft,df as ht,dg as Wa,dh as Ho,di as Ja,dj as Za,dk as Go,dl as Cf,dm as Ff,dn as Kf,dp as Tf,dq as Pf,dr as xf,ds as If,dt as La,du as Wo,dv as Df,dw as Lf,dx as yr,dy as _f,dz as Af,dA as wf,dB as Rf,dC as Ef,dD as Mf,dE as Jo,dF as Vf,dG as zf,dH as Nf,dI as $f,dJ as _a,dK as Li,dL as Zo,dM as Na,dN as wt,dO as jf,dP as Of,dQ as _i,dR as kt,dS as Ln,dT as Xt,dU as Xo,dV as Qf,dW as Bf,dX as Yo,dY as es,dZ as qf,d_ as Uf,d$ as ns,e0 as Hf,e1 as Gf,e2 as fr,e3 as Wf,e4 as Jf,e5 as Zf,e6 as Xf,e7 as Yf,e8 as eh,e9 as Rt,ea as as,eb as nh,ec as ah,ed as hr,ee as lh,ef as th,eg as $a,eh as ih,ei as rh,ej as oh,ek as sh,el as dh,em as bt,en as ls,eo as kr,ep as ch,eq as uh,er as mh,es as gh,et as ts,eu as ph,ev as yh,ew as fh,ex as br,ey as Sr}from"./components-ClD3sHta.js";import{g as Ca,i as Fa,d as hh,E as is,R as Ka,k as Ai,b as kh,p as xl,n as rs}from"./vendor-codemirror-DWdZV1Is.js";import{P as os,C as ss,T as ea,a as ds,R as On,X as na,Y as In,b as aa,B as Aa,c as St,d as Il,A as vl,e as cs,L as us,f as bh}from"./vendor-recharts-BfHdRd1Y.js";const Sh=4,vh="Unable to parse span input messages, expected messages which include a role and content.",Ch="Unable to parse span output messages, expected messages which include a role and content.",Fh="Unable to parse span output expected output.value to be present.",Kh="Unable to parse span attributes, attributes must be valid JSON.",Th="Unable to parse model config, expected llm.model_name to be present.",Ph="Unable to parse model config, expected llm.invocation_parameters JSON string to be present.",xh="Unable to parse invocation parameters response_format, expected llm.invocation_parameters.response_format to be a well formed json object or undefined.",Ih="Unable to parse tools, expected tools to be an array of valid tools.",Dh="Unable to parse prompt template variables, expected prompt template variables to be a valid JSON object string.",vr={AZURE_OPENAI:[],ANTHROPIC:["claude"],OPENAI:["gpt","o1"],GOOGLE:["gemini"],DEEPSEEK:["deepseek"]},ca="TOOL_CHOICE",ja="tool_choice",wn="RESPONSE_FORMAT",_n="response_format",Lh=[ca,wn],_h=R.object({tool_call:R.object({id:R.string().optional(),function:R.object({name:R.string(),arguments:R.string()}).partial()}).partial()}).partial(),ms=R.object({[ve.message]:R.object({[ze.role]:R.string(),[ze.content]:R.union([R.string(),R.array(R.record(R.string(),R.unknown()))]).default(""),[ze.contents]:R.array(R.object({message_content:R.record(R.string())})).optional(),[ze.tool_calls]:R.array(_h).optional(),[ze.tool_call_id]:R.string().optional()})}),Ah=R.object({[ve.llm]:R.object({[Be.input_messages]:R.array(ms)})}),wh=R.object({[ve.llm]:R.object({[Be.output_messages]:R.array(ms)})}),Rh=R.object({[ve.output]:R.object({value:R.string()})}),gs=Hp()(R.enum(["user","ai","system","tool"])),Eh=R.object({id:R.number(),role:gs,content:R.string().optional(),toolCallId:R.string().optional(),toolCalls:R.array(Gp).optional()}),Mh=R.array(Eh),ps=R.lazy(()=>R.record(mi)),Vh=ps,ys=R.string().transform((n,a)=>{const{json:l}=Qe(n);if(!gi(l))return a.addIssue({code:R.ZodIssueCode.custom,message:"The invocation parameters must be a valid JSON object"}),R.NEVER;const{success:t,data:i}=Vh.safeParse(l);return t?i:(a.addIssue({code:R.ZodIssueCode.custom,message:"The invocation parameters must be a valid JSON object"}),R.NEVER)}).default("{}"),zh=R.object({[ve.llm]:R.object({[Be.provider]:R.string().optional(),[Be.model_name]:R.string()})}),fs=R.object({[ve.llm]:R.object({[Be.invocation_parameters]:ys})}),Nh=R.object({[ve.llm]:R.object({[Be.invocation_parameters]:ys.pipe(R.object({response_format:ps.optional()}))})}),$h=R.object({url:R.object({full:R.string(),path:R.string().optional()})}),jh=R.string().transform((n,a)=>{const{json:l}=Qe(n);return l==null||!gi(l)?(a.addIssue({code:R.ZodIssueCode.custom,message:"The tool JSON schema must be a valid JSON object"}),R.NEVER):l}).transform((n,a)=>{const{data:l,success:t}=Wp.safeParse(n);return t?l:(a.addIssue({code:R.ZodIssueCode.custom,message:"The tool JSON schema must be a valid tool schema"}),R.NEVER)}),Oh=R.object({[ve.llm]:R.object({[Be.tools]:R.array(R.object({[ve.tool]:R.object({[Nl.json_schema]:jh})}).optional()).optional()}).optional()}).optional(),Qh=R.lazy(()=>R.object({type:R.literal("json_schema"),json_schema:R.object({name:R.string().describe("The name of the schema"),schema:Jp.describe("The schema itself in JSON schema format"),strict:R.literal(!0).describe("The schema must be strict")})})),Bh=Gl(Qh,{removeAdditionalStrategy:"passthrough"}),qh=R.string().transform((n,a)=>{const{json:l}=Qe(n);return ma(l)?Object.entries(l).reduce((i,[r,s])=>{if(typeof s=="string")i[r]=s;else{const{json:d}=En(s);d!=null&&(i[r]=d)}return i},{}):(a.addIssue({code:R.ZodIssueCode.custom,message:"The prompt template variables must be a valid JSON object"}),R.NEVER)}),Uh=R.object({[ve.llm]:R.object({[Be.prompt_template]:R.object({variables:qh}).optional()}).optional()}).optional();function hs(n){return gs.safeParse(n).success}function ia(n){const a=n.toLowerCase();if(hs(a))return a;for(const[l,t]of Object.entries($l))if(t.includes(a))return l;return Zp}function Hh({toolCalls:n,provider:a}){if(n!=null)return n.map(({tool_call:l})=>{var i,r,s,d;if(l==null)return null;let t={};if(((i=l.function)==null?void 0:i.arguments)!=null){const{json:c}=Qe(l.function.arguments);ma(c)&&(t=c)}switch(a){case"OPENAI":case"AZURE_OPENAI":case"DEEPSEEK":return{id:l.id??"",type:"function",function:{name:((r=l.function)==null?void 0:r.name)??"",arguments:t}};case"ANTHROPIC":return{id:l.id??"",type:"tool_use",name:((s=l.function)==null?void 0:s.name)??"",input:t};case"GOOGLE":return{id:l.id??"",function:{name:((d=l.function)==null?void 0:d.name)??"",arguments:t}};default:Pe()}}).filter(l=>l!=null)}function ks({messages:n,provider:a}){return n.map(({message:l})=>{var t,i;return{id:oa(),role:l.tool_call_id!=null?ia("tool"):ia(l.role),content:Array.isArray(l.contents)?((i=(t=l.contents.find(r=>r.message_content.type==="text"))==null?void 0:t.message_content)==null?void 0:i.text)??void 0:typeof l.content=="string"?l.content:void 0,toolCalls:Hh({provider:a,toolCalls:l.tool_calls}),toolCallId:l.tool_call_id}})}function Gh({provider:n,parsedAttributes:a}){var t;const l=Ah.safeParse(a);if(!l.success)return{messageParsingErrors:[vh],messages:null};if(n==="ANTHROPIC"){const{success:i,data:r}=fs.safeParse(a);if(i){const s=l.data.llm.input_messages,d=(t=r.llm.invocation_parameters)==null?void 0:t.system;typeof d=="string"&&d&&(!s||s[0].message.role!=="system")&&l.data.llm.input_messages.unshift({message:{role:"system",content:d}})}}return{messageParsingErrors:[],messages:ks({provider:n,messages:l.data.llm.input_messages})}}function Wh({provider:n,parsedAttributes:a}){const l=[],t=wh.safeParse(a);if(t.success)return{output:ks({provider:n,messages:t.data.llm.output_messages}),outputParsingErrors:l};l.push(Ch);const i=Rh.safeParse(a);return i.success?{output:i.data.output.value,outputParsingErrors:l}:(l.push(Fh),{output:void 0,outputParsingErrors:l})}function bs(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 Jh(n){for(const a of Object.keys(vr))if(vr[a].some(t=>n.includes(t)))return a;return uo}function Zh(n){const{success:a,data:l}=zh.safeParse(n);if(a){const t=bs(l.llm.provider)||Jh(l.llm.model_name),i=Xh(n);return{modelConfig:{...Object.fromEntries(Object.entries(i).filter(([r,s])=>s!==null)),modelName:l.llm.model_name,provider:t,invocationParameters:[],supportedInvocationParameters:[]},parsingErrors:[]}}return{modelConfig:null,parsingErrors:[Th]}}function Xh(n){const{success:a,data:l}=$h.safeParse(n);if(a)try{const t=new URL(l.url.full);let i=t;if(l.url.path)try{i=new URL(l.url.full.split(l.url.path)[0])}catch{}return{baseUrl:`${i.origin}${i.pathname}`,endpoint:t.origin,apiVersion:t.searchParams.get("api-version")||null}}catch{}return{baseUrl:null,apiVersion:null,endpoint:null}}function Yh(n,a=[]){const{success:l,data:t}=fs.safeParse(n),i=[];return l||i.push(Ph),{invocationParameters:s0((t==null?void 0:t.llm.invocation_parameters)??{},a),parsingErrors:i}}function e0(n){const{success:a,data:l}=Nh.safeParse(n);return a?{responseFormat:l.llm.invocation_parameters.response_format,parsingErrors:[]}:{responseFormat:void 0,parsingErrors:[xh]}}function n0(n){var a;return(((a=n==null?void 0:n.llm)==null?void 0:a.tools)??[]).map(l=>(l==null?void 0:l.tool)==null?null:{id:cl(),definition:l.tool.json_schema}).filter(l=>l!=null)}function a0(n){var t;const{data:a,success:l}=Oh.safeParse(n);return l?((t=a==null?void 0:a.llm)==null?void 0:t.tools)==null?{tools:null,parsingErrors:[]}:{tools:n0(a),parsingErrors:[]}:{tools:null,parsingErrors:[Ih]}}function l0(n){var t;const{success:a,data:l}=Uh.safeParse(n);return a?((t=l==null?void 0:l.llm)==null?void 0:t.prompt_template)==null?{variables:null,parsingErrors:[]}:{variables:l.llm.prompt_template.variables,parsingErrors:[]}:{variables:null,parsingErrors:[Dh]}}function t0(n){const{instance:a,instanceMessages:l}=co(),t={...a,template:{__type:"chat",messages:Object.values(l)}},{json:i,parseError:r}=Qe(n.attributes);if(r)return{playgroundInstance:{...t,spanId:(n==null?void 0:n.id)??null},parsingErrors:[Kh]};const s=n.invocationParameters,d=Zh(i);let{modelConfig:c}=d;const{parsingErrors:p}=d,{messages:y,messageParsingErrors:u}=Gh({provider:(c==null?void 0:c.provider)??t.model.provider,parsedAttributes:i}),{output:g,outputParsingErrors:f}=Wh({provider:(c==null?void 0:c.provider)??t.model.provider,parsedAttributes:i}),{invocationParameters:k,parsingErrors:h}=Yh(i,s),{variables:S,parsingErrors:K}=l0(i),{parsingErrors:P}=e0(i);c=c!=null?{...c,invocationParameters:P.length>0?k.filter(L=>L.invocationName!==_n&&L.canonicalName!==wn):k}:null;const{tools:I,parsingErrors:D}=a0(i),T=y==null?void 0:y.map(L=>({...L,content:L.role==="tool"?wi(L.content):L.content}));return{playgroundInstance:{...t,model:c??t.model,template:T!=null?{__type:"chat",messages:T}:t.template,output:g,spanId:n.id,tools:I??t.tools},playgroundInput:S!=null?{variablesValueCache:S}:void 0,parsingErrors:[...u,...f,...p,...D,...h,...P,...K]}}const i0=n=>Mh.safeParse(n).success,Ss=({instance:n,templateFormat:a})=>{if(a==fn.NONE)return[];const l=new Set,t=n.template.__type,i=Xp(a);switch(t){case"chat":{n.template.messages.forEach(r=>{(r.content==null?[]:i.extractVariables(r.content)).forEach(d=>{l.add(d)})});break}case"text_completion":{i.extractVariables(n.template.prompt).forEach(s=>{l.add(s)});break}default:Pe()}return Array.from(l)},r0=({instances:n,templateFormat:a})=>a==fn.NONE?[]:Array.from(new Set(n.flatMap(l=>Ss({instance:l,templateFormat:a})))),vs=({instances:n,templateFormat:a,input:l})=>{if(a==fn.NONE)return{variablesMap:{},variableKeys:[]};const t=r0({instances:n,templateFormat:a}),i=l.variablesValueCache??{};return{variablesMap:t.reduce((s,d)=>(s[d]=i[d]||"",s),{}),variableKeys:t}};function ga(n,a){return n.invocationName===a.invocationName||n.canonicalName!=null&&a.canonicalName!=null&&n.canonicalName===a.canonicalName}const o0=(n,a)=>n.filter(l=>a.some(t=>ga(t,l))).map(l=>{var t;return{...l,invocationName:((t=a.find(i=>ga(i,l)))==null?void 0:t.invocationName)??l.invocationName}}),Xa=n=>n.replace(/_([a-z])/g,(a,l)=>l.toUpperCase()),s0=(n,a)=>Object.entries(n).map(([l,t])=>{const i=a.find(r=>r.canonicalName&&r.canonicalName.toLowerCase()===l.toLowerCase()||r.invocationName&&r.invocationName.toLowerCase()===l.toLowerCase());return i==null||i.invocationInputField==null||i.invocationName==null?null:{canonicalName:i.canonicalName,invocationName:i.invocationName,[Xa(i.invocationInputField)]:t}}).filter(l=>l!=null),Cs=n=>{const{provider:a,validatedToolDefinition:l}=ny(n.definition);switch(a){case"OPENAI":case"AZURE_OPENAI":return l.function.name;case"ANTHROPIC":return l.name;case"UNKNOWN":return null;default:Pe()}},d0=({provider:n,toolNumber:a})=>{switch(n){case"OPENAI":case"DEEPSEEK":case"AZURE_OPENAI":return{id:cl(),definition:or(a)};case"ANTHROPIC":return{id:cl(),definition:ey(a)};case"GOOGLE":return{id:cl(),definition:or(a)};default:Pe()}},c0=n=>{switch(n){case"OPENAI":case"AZURE_OPENAI":case"DEEPSEEK":return rr();case"ANTHROPIC":return Yp();case"GOOGLE":return rr();default:Pe()}};function u0(n){return{content:n.content,role:m0(n.role),toolCalls:n.toolCalls,toolCallId:n.toolCallId}}function m0(n){switch(n){case"system":return"SYSTEM";case"user":return"USER";case"tool":return"TOOL";case"ai":return"AI";default:Pe()}}const Fs=({playgroundStore:n,instanceId:a,credentials:l})=>{var u;const{instances:t,allInstanceMessages:i}=n.getState(),r=t.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 s=r.template.messageIds.map(g=>i[g]).filter(g=>g!=null),d=r.model.supportedInvocationParameters;let c=[...r.model.invocationParameters];const p=pi({toolChoice:r.toolChoice,targetProvider:r.model.provider});r.tools.length>0?(c=c.filter(g=>g.invocationName!==ja&&g.canonicalName!==ca),c.push({canonicalName:ca,invocationName:ja,valueJson:p})):c=c.filter(g=>g.invocationName!==ja&&g.canonicalName!==ca),c=d.length?o0(c,d):c;const y=r.model.provider==="AZURE_OPENAI"?{endpoint:r.model.endpoint,apiVersion:r.model.apiVersion}:{};return{messages:s.map(u0),model:{providerKey:r.model.provider,name:r.model.modelName||"",baseUrl:r.model.baseUrl,...y},invocationParameters:Ts(c,r.model.provider,r.model.modelName),tools:r.tools.length?r.tools.map(g=>g.definition):void 0,apiKey:l[r.model.provider]||null,promptName:(u=r.prompt)==null?void 0:u.name}},vt=(n,a)=>{if(n.template.__type==="chat"){const{messageIds:l,...t}=n.template;return{...n,template:{...t,messages:n.template.messageIds.map(i=>a[i])}}}return n},g0=({playgroundStore:n,instanceId:a,credentials:l})=>{const t=Fs({playgroundStore:n,instanceId:a,credentials:l}),{instances:i,templateFormat:r,input:s,allInstanceMessages:d}=n.getState(),c=i.map(y=>vt(y,d)),{variablesMap:p}=vs({instances:c,input:s,templateFormat:r});return{...t,template:{variables:p,format:r}}},Cr=({playgroundStore:n,instanceId:a,credentials:l,datasetId:t})=>({...Fs({playgroundStore:n,instanceId:a,credentials:l}),templateFormat:n.getState().templateFormat,datasetId:t});function wi(n){if(typeof n=="string"){const a=n.startsWith('"{')||n.startsWith('"[')||n.startsWith('"\\"');try{if(a){const t=JSON.parse(n),i=typeof t=="string"?JSON.parse(t):t;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 Ks(n,a){return a.filter(l=>l.required).every(l=>n.some(t=>ga(t,l)))}const p0=n=>{for(const[a,l]of Object.entries(n))if(a.endsWith("DefaultValue")&&l!=null)return n[a]};function BK(n,a){const l=new Map(n.map(t=>[t.invocationName,t]));return a.forEach(t=>{var c;const i=t.invocationName,r=p0(t),s=Xa(t.invocationInputField||"");if(!t.invocationName||!t.invocationInputField||!i||r==null||((c=l.get(i))==null?void 0:c[s])!=null)return;const d={canonicalName:t.canonicalName,invocationName:t.invocationName,[s]:r};l.set(i,d)}),Array.from(l.values())}const y0=R.object({type:R.literal("enabled")}).passthrough(),f0=R.object({type:R.enum(["any","tool"])}).passthrough(),h0=(n,a)=>{if(!a)return n;const l=n.some(t=>t.canonicalName==="ANTHROPIC_EXTENDED_THINKING"&&t.valueJson&&y0.safeParse(t.valueJson).success);return n.filter(t=>{if(t.canonicalName==="ANTHROPIC_EXTENDED_THINKING"&&!t.valueJson)return!1;if(l){if(t.canonicalName==="TEMPERATURE"||t.canonicalName==="TOP_P")return!1;if(t.canonicalName===ca)return!f0.safeParse(t.valueJson).success}return!0})},Ts=(n,a,l)=>a==="ANTHROPIC"?h0(n,l):n,Ps=m.createContext(null);function qK({children:n,...a}){const[l]=m.useState(()=>ay(a));return e(Ps.Provider,{value:l,children:n})}function Qa(n,a){const l=m.useContext(Ps);if(!l)throw new Error("Missing CredentialsContext.Provider in the tree");return Cl(l,n,a)}const xs="arize-phoenix-feature-flags",Et={dashboards:!1};function k0(){const n=localStorage.getItem(xs);if(!n)return Et;try{const a=JSON.parse(n);return Object.assign({},Et,a)}catch{return Et}}const Is=m.createContext(null);function Ds(){const n=sn.useContext(Is);if(n===null)throw new Error("useFeatureFlags must be used within a FeatureFlagsProvider");return n}function b0(n){const{featureFlags:a}=Ds();return a[n]}function UK(n){const[a,l]=m.useState(k0()),t=i=>{localStorage.setItem(xs,JSON.stringify(i)),l(i)};return e(Is.Provider,{value:{featureFlags:a,setFeatureFlags:t},children:e(S0,{children:n.children})})}function S0(n){const{children:a}=n,{featureFlags:l,setFeatureFlags:t}=Ds(),[i,r]=m.useState(!1);return ua("ctrl+shift+f",()=>r(!0)),o(J,{children:[a,e(re,{type:"modal",isDismissable:!0,onDismiss:()=>r(!1),children:i&&e(te,{title:"Feature Flags",children:e(v,{height:"size-1000",padding:"size-100",children:Object.keys(l).map(s=>e(ha,{isSelected:l[s],onChange:d=>t({...l,[s]:d}),children:s},s))})})})]})}const Ls=m.createContext(null);function v0(){const n=m.useContext(Ls);if(n===null)throw new Error("useFunctionality must be used within a FunctionalityProvider");return n}function HK(n){return e(Ls.Provider,{value:{authenticationEnabled:window.Config.authenticationEnabled},children:n.children})}const _s={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};_s.hash="0168d590171b96e7a2e41449a41754be";function C0({query:n}){const[a,l]=m.useState(null),t=Qa(y=>y),i=Qa(y=>y.setCredential),r=x.useFragment(_s,n),s=m.useMemo(()=>[...r.modelProviders],[r]),d=m.useMemo(()=>[{header:"Name",accessorKey:"name",cell:({row:y})=>o(b,{direction:"row",alignItems:"center",gap:"size-100",children:[e(et,{provider:y.original.key,height:18}),y.original.name]})},{header:"Environment Variable",accessorKey:"apiKeyEnvVar",cell:({row:y})=>e(C,{children:y.original.apiKeyEnvVar})},{header:"configuration",accessorKey:"apiKeySet",cell:({row:y})=>y.original.dependenciesInstalled?t[y.original.key]?e(C,{color:"success",children:"local"}):y.original.apiKeySet?e(C,{color:"success",children:"configured on the server"}):e(C,{color:"text-700",children:"not configured"}):e(C,{color:"warning",children:"missing dependencies"})},{header:"",accessorKey:"id",cell:({row:y})=>e(b,{direction:"row",justifyContent:"end",gap:"size-100",width:"100%",children:e(E,{size:"S",leadingVisual:e(_,{svg:e(Sa,{})}),onPress:()=>{l(y.original)}})})}],[t]),c=Ke({columns:d,data:s,getCoreRowModel:Te(),getSortedRowModel:ln()}),p=c.getRowModel().rows;return o(B,{title:"AI Providers",bodyStyle:{padding:0},variant:"compact",children:[o("table",{css:He,children:[e("thead",{children:c.getHeaderGroups().map(y=>e("tr",{children:y.headers.map(u=>e("th",{colSpan:u.colSpan,children:u.isPlaceholder?null:e("div",{children:W(u.column.columnDef.header,u.getContext())})},u.id))},y.id))}),e("tbody",{children:p.map(y=>e("tr",{children:y.getVisibleCells().map(u=>e("td",{children:W(u.column.columnDef.cell,u.getContext())},u.id))},y.id))})]}),e(re,{type:"modal",isDismissable:!0,onDismiss:()=>l(null),children:a&&o(te,{title:`Set ${a.name} API Key`,size:"S",children:[o(v,{padding:"size-200",children:[e(v,{paddingBottom:"size-100",children:o(C,{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."]})}),o(X,{onChange:y=>{i({provider:a.key,value:y})},value:t[a.key],type:"password",children:[e(G,{children:`${a.name} API Key`}),e(Z,{placeholder:`e.g. ${a.apiKeyEnvVar}`}),e(C,{slot:"description",children:"The API key will be stored locally in your browser"})]})]}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopWidth:"thin",borderColor:"light",children:e(b,{direction:"row",justifyContent:"end",gap:"size-100",children:e(E,{variant:"primary",size:"S",onPress:()=>{l(null)},children:"Set API Key"})})})]})})]})}function GK(){const n=Me();return je(n),e(C0,{query:n})}const As={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
|
|
|
@@ -207,7 +207,7 @@ fragment AnnotationConfigTableFragment on Query {
|
|
|
207
207
|
& input {
|
|
208
208
|
max-height: fit-content;
|
|
209
209
|
}
|
|
210
|
-
`,children:[e(H,{control:r,name:"lowerBound",rules:{required:"Min is required"},render:({field:{value:k,...h},fieldState:{error:S}})=>o(sa,{...h,value:typeof k=="number"?k:void 0,isInvalid:!!S,children:[e(G,{children:"Min"}),e(Z,{placeholder:"0"}),e(Se,{children:S==null?void 0:S.message})]})}),e(H,{control:r,name:"upperBound",rules:{validate:k=>{const h=d("lowerBound");return h!=null&&k!=null&&k<=h?"Max must be greater than min":k!=null&&isNaN(k)?"Max is required":!0}},render:({field:{value:k,...h},fieldState:{error:S}})=>{const K=d("lowerBound");return o(sa,{...h,value:typeof k=="number"?k:void 0,isInvalid:!!S,minValue:typeof K=="number"?K:void 0,children:[e(G,{children:"Max"}),e(Z,{placeholder:"1"}),e(Se,{children:S==null?void 0:S.message})]})}})]}),g==="CATEGORICAL"&&o(J,{children:[e(C,{size:"XS",weight:"heavy",children:"Categories"}),c.map((k,h)=>o(b,{direction:"row",gap:"size-100",alignItems:"start",children:[e(H,{control:r,name:`values.${h}.label`,rules:{required:"Category label is required"},render:({field:S,fieldState:{error:K}})=>o(X,{...S,"aria-label":`Value ${h+1}`,isInvalid:!!K,autoFocus:h>0,children:[e(Z,{placeholder:`e.g. ${Fr[h%Fr.length]}`}),e(Se,{children:K==null?void 0:K.message})]})}),e(H,{control:r,name:`values.${h}.score`,render:({field:S,fieldState:{error:K}})=>o(sa,{...S,value:typeof S.value=="number"?S.value:void 0,"aria-label":`Score ${h+1}`,isInvalid:!!K,children:[e(b,{direction:"row",gap:"size-100",alignItems:"center",children:e(Z,{placeholder:`e.g. ${h} (optional)`})}),e(Se,{children:K==null?void 0:K.message})]})}),e(E,{type:"button",leadingVisual:e(_,{svg:e(
|
|
210
|
+
`,children:[e(H,{control:r,name:"lowerBound",rules:{required:"Min is required"},render:({field:{value:k,...h},fieldState:{error:S}})=>o(sa,{...h,value:typeof k=="number"?k:void 0,isInvalid:!!S,children:[e(G,{children:"Min"}),e(Z,{placeholder:"0"}),e(Se,{children:S==null?void 0:S.message})]})}),e(H,{control:r,name:"upperBound",rules:{validate:k=>{const h=d("lowerBound");return h!=null&&k!=null&&k<=h?"Max must be greater than min":k!=null&&isNaN(k)?"Max is required":!0}},render:({field:{value:k,...h},fieldState:{error:S}})=>{const K=d("lowerBound");return o(sa,{...h,value:typeof k=="number"?k:void 0,isInvalid:!!S,minValue:typeof K=="number"?K:void 0,children:[e(G,{children:"Max"}),e(Z,{placeholder:"1"}),e(Se,{children:S==null?void 0:S.message})]})}})]}),g==="CATEGORICAL"&&o(J,{children:[e(C,{size:"XS",weight:"heavy",children:"Categories"}),c.map((k,h)=>o(b,{direction:"row",gap:"size-100",alignItems:"start",children:[e(H,{control:r,name:`values.${h}.label`,rules:{required:"Category label is required"},render:({field:S,fieldState:{error:K}})=>o(X,{...S,"aria-label":`Value ${h+1}`,isInvalid:!!K,autoFocus:h>0,children:[e(Z,{placeholder:`e.g. ${Fr[h%Fr.length]}`}),e(Se,{children:K==null?void 0:K.message})]})}),e(H,{control:r,name:`values.${h}.score`,render:({field:S,fieldState:{error:K}})=>o(sa,{...S,value:typeof S.value=="number"?S.value:void 0,"aria-label":`Score ${h+1}`,isInvalid:!!K,children:[e(b,{direction:"row",gap:"size-100",alignItems:"center",children:e(Z,{placeholder:`e.g. ${h} (optional)`})}),e(Se,{children:K==null?void 0:K.message})]})}),e(E,{type:"button",leadingVisual:e(_,{svg:e(Ge,{})}),"aria-label":"Remove category",onPress:()=>y(h)})]},k.id)),e(b,{justifyContent:"end",width:"100%",children:e(E,{type:"button",onPress:()=>{p({label:"",score:null})},leadingVisual:e(_,{svg:e(da,{})}),children:"Add category"})})]})]})}),e(v,{paddingX:"size-200",paddingY:"size-200",borderTopColor:"dark",borderTopWidth:"thin",children:o(b,{gap:"size-100",justifyContent:"end",children:[e(E,{type:"button",onPress:f,children:"Cancel"}),e(E,{type:"submit",variant:"primary",children:i==="new"?"Create Annotation Config":"Update Annotation Config"})]})})]})})})},zs=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"AnnotationConfigTableFragment",selections:[{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"annotationConfig",args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[n,a,l,t,i,{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null}],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[n,a,l,t,i,{alias:null,args:null,kind:"ScalarField",name:"upperBound",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"lowerBound",storageKey:null}],type:"ContinuousAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[n,a,l,t],type:"FreeformAnnotationConfig",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null}}();zs.hash="21da6fc76dc125423a2f4ecd8ef70866";const T0=({selectedConfig:n,onClearSelection:a,onEditAnnotationConfig:l,onDeleteAnnotationConfig:t})=>{const[i,r]=m.useState(!1);if(!n)return null;const s=n==null?void 0:n.id;return e("div",{"data-editing":i,css:F`
|
|
211
211
|
position: fixed;
|
|
212
212
|
bottom: var(--ac-global-dimension-size-600);
|
|
213
213
|
left: 50%;
|
|
@@ -218,15 +218,15 @@ fragment AnnotationConfigTableFragment on Query {
|
|
|
218
218
|
&[data-editing="true"] {
|
|
219
219
|
display: none;
|
|
220
220
|
}
|
|
221
|
-
`,children:e(v,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:o(b,{direction:"row",gap:"size-100",alignItems:"center",justifyContent:"space-between",children:[o(C,{children:['Config: "',n==null?void 0:n.name,'"']}),o(b,{direction:"row",gap:"size-100",children:[e(E,{variant:"quiet",onPress:a,children:"Clear Selection"}),o(
|
|
221
|
+
`,children:e(v,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:o(b,{direction:"row",gap:"size-100",alignItems:"center",justifyContent:"space-between",children:[o(C,{children:['Config: "',n==null?void 0:n.name,'"']}),o(b,{direction:"row",gap:"size-100",children:[e(E,{variant:"quiet",onPress:a,children:"Clear Selection"}),o(Ue,{onOpenChange:d=>{r(d),d||a()},children:[o(E,{variant:"danger",children:[e(_,{svg:e(Ge,{})}),"Delete"]}),e(yn,{children:e(pn,{css:F`
|
|
222
222
|
border: none;
|
|
223
|
-
`,children:({close:d})=>o(B,{title:"Delete Annotation Config",bodyStyle:{padding:0},variant:"compact",children:[e(v,{padding:"size-200",children:e(C,{children:"Are you sure you want to delete this annotation config? Annotations made with this config will not be impacted."})}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopColor:"dark",borderTopWidth:"thin",children:o(b,{gap:"size-100",justifyContent:"end",children:[e(E,{variant:"quiet",onPress:d,children:"Cancel"}),e(E,{variant:"danger",onPress:()=>{s&&t(s,{onCompleted:()=>{d()}})},children:"Delete"})]})})]})})})]}),o(
|
|
223
|
+
`,children:({close:d})=>o(B,{title:"Delete Annotation Config",bodyStyle:{padding:0},variant:"compact",children:[e(v,{padding:"size-200",children:e(C,{children:"Are you sure you want to delete this annotation config? Annotations made with this config will not be impacted."})}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopColor:"dark",borderTopWidth:"thin",children:o(b,{gap:"size-100",justifyContent:"end",children:[e(E,{variant:"quiet",onPress:d,children:"Cancel"}),e(E,{variant:"danger",onPress:()=>{s&&t(s,{onCompleted:()=>{d()}})},children:"Delete"})]})})]})})})]}),o(Ue,{onOpenChange:d=>{r(d),d||a()},children:[o(E,{size:"S",variant:"primary",children:[e(_,{svg:e(Sa,{})}),"Edit"]}),e(yn,{children:e(Vs,{initialAnnotationConfig:n,onAddAnnotationConfig:l})})]})]})]})})})},P0=[{id:"select",maxSize:10,header:()=>null,cell:({row:n})=>e(Mn,{checked:n.getIsSelected(),disabled:!n.getCanSelect(),indeterminate:n.getIsSomeSelected(),onChange:n.getToggleSelectedHandler()})},{id:"name",header:"Name",accessorKey:"name",cell:({row:n})=>e(Ua,{annotation:n.original,annotationDisplayPreference:"none",css:F`
|
|
224
224
|
width: fit-content;
|
|
225
|
-
`},n.original.id)},{id:"description",header:"Description",accessorKey:"description",sortUndefined:"last",accessorFn:n=>n.description??void 0,maxSize:150,cell:({row:n})=>e(
|
|
225
|
+
`},n.original.id)},{id:"description",header:"Description",accessorKey:"description",sortUndefined:"last",accessorFn:n=>n.description??void 0,maxSize:150,cell:({row:n})=>e(dn,{maxWidth:"100%",children:e(C,{children:n.original.description})})},{id:"annotationType",header:"Type",accessorKey:"annotationType",minSize:10,cell:({row:n})=>e(C,{children:n.original.annotationType.charAt(0).toUpperCase()+n.original.annotationType.slice(1).toLowerCase()})},{id:"values",header:"Values",enableSorting:!1,accessorFn:n=>{switch(n.annotationType){case"CATEGORICAL":{if(!n.values)return"";let a=n.values.map((l,t)=>e(Cn,{title:l.label,children:e(dn,{maxWidth:"40px",children:l.label})},t));return n.values.length>5&&(a=[...a.slice(-4),o(Le,{delay:64,placement:"bottom right",children:[e(Ne,{children:o(Cn,{css:F`
|
|
226
226
|
white-space: nowrap;
|
|
227
|
-
`,children:["+ ",n.values.length-5," more"]},"ellipsis")}),e(
|
|
227
|
+
`,children:["+ ",n.values.length-5," more"]},"ellipsis")}),e(gn,{children:n.values.map(l=>l.label).join(", ")})]},"ellipsis")]),a}case"CONTINUOUS":return`from ${n.lowerBound} to ${n.upperBound}`;case"FREEFORM":return"";default:return""}},cell:({getValue:n})=>{const a=n();return e(b,{gap:"size-100",children:a})}}],x0=({annotationConfigs:n,onDeleteAnnotationConfig:a,onEditAnnotationConfig:l})=>{const[t,i]=m.useState({}),r=x.useFragment(zs,n),s=m.useMemo(()=>r.annotationConfigs.edges.map(f=>f.annotationConfig),[r.annotationConfigs.edges]),d=Ke({data:s,columns:P0,getCoreRowModel:Te(),getSortedRowModel:ln(),enableRowSelection:!0,onRowSelectionChange:i,enableMultiRowSelection:!1,state:{rowSelection:t}}),c=d.getRowCount()===0,p=d.getRowModel().rows,y=d.getSelectedRowModel().rows,u=y.map(f=>f.original),g=()=>{i({})};return o("div",{css:F`
|
|
228
228
|
overflow: auto;
|
|
229
|
-
`,children:[o("table",{css:
|
|
229
|
+
`,children:[o("table",{css:He,style:{width:d.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:d.getHeaderGroups().map(f=>e("tr",{children:f.headers.map(k=>e("th",{colSpan:k.colSpan,children:k.isPlaceholder?null:o("div",{className:k.column.getCanSort()?"cursor-pointer":"",onClick:k.column.getToggleSortingHandler(),style:{left:k.getStart(),width:k.getSize()},children:[W(k.column.columnDef.header,k.getContext()),k.column.getIsSorted()?e(_,{className:"sort-icon",svg:k.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]})},k.id))},f.id))}),c?e(tn,{message:"No Annotation Configs"}):e("tbody",{children:p.map(f=>e("tr",{onClick:()=>{i({[f.id]:!(t!=null&&t[f.id])})},children:f.getVisibleCells().map(k=>e("td",{style:{width:k.column.getSize(),maxWidth:k.column.getSize()},children:W(k.column.columnDef.cell,k.getContext())},k.id))},f.id))})]}),y.length>0&&e(T0,{selectedConfig:u[0],onClearSelection:g,onEditAnnotationConfig:l,onDeleteAnnotationConfig:a})]})},JK=()=>{const n=Me();return e(I0,{annotations:n})},I0=({annotations:n})=>{const{revalidate:a}=sp(),l=x.useFragment(Ms,n),[t]=x.useMutation(Es),[i]=x.useMutation(Rs),r=y=>u=>{const g=Ie(u);y==null||y((g==null?void 0:g[0])??"Failed to create annotation config")},s=(y,{onCompleted:u,onError:g}={})=>{const{id:f,annotationType:k,...h}=y,S=k.toLowerCase();i({variables:{input:{annotationConfig:{[S]:h}}},onCompleted:u,onError:r(g)}),a()},[d]=x.useMutation(ws);return e(B,{title:"Annotation Configs",variant:"compact",bodyStyle:{padding:0},extra:o(Ue,{children:[o(E,{size:"S",children:[e(_,{svg:e(da,{})}),"New Configuration"]}),e(yn,{children:e(Vs,{onAddAnnotationConfig:s})})]}),children:e(x0,{annotationConfigs:l,onEditAnnotationConfig:(y,{onCompleted:u,onError:g}={})=>{const{id:f,annotationType:k,...h}=y,S=k.toLowerCase();d({variables:{input:{id:f,annotationConfig:{[S]:h}}},onCompleted:u,onError:r(g)}),a()},onDeleteAnnotationConfig:(y,{onCompleted:u,onError:g}={})=>{t({variables:{input:{ids:[y]}},onCompleted:u,onError:r(g)}),a()}})})},Ns=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"settingsAnnotationsPageLoaderQuery",selections:[{args:null,kind:"FragmentSpread",name:"SettingsAnnotationsPageFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"settingsAnnotationsPageLoaderQuery",selections:[{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"annotationConfig",args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[n,a,l,t,i,{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null}],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[n,a,l,t,i,{alias:null,args:null,kind:"ScalarField",name:"upperBound",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"lowerBound",storageKey:null}],type:"ContinuousAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[n,a,l,t],type:"FreeformAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[n],type:"Node",abstractKey:"__isNode"}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"38239699bb1676189730a7c5bfaf3e16",id:null,metadata:{},name:"settingsAnnotationsPageLoaderQuery",operationKind:"query",text:`query settingsAnnotationsPageLoaderQuery {
|
|
230
230
|
...SettingsAnnotationsPageFragment
|
|
231
231
|
}
|
|
232
232
|
|
|
@@ -495,14 +495,14 @@ fragment RetentionPoliciesTable_retentionPolicy on ProjectTraceRetentionPolicy {
|
|
|
495
495
|
id
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
|
-
`}}}();Gs.hash="3bf941d551e8fb7a6940d8774075be73";function L0(n){var d,c;const a=me(),l=ke(),t=x.useLazyLoadQuery(Gs,{id:n.policyId});if(!(t!=null&&t.retentionPolicy))throw new Error("Retention policy not found");const[i,r]=x.useMutation(Hs);return e(Os,{onSubmit:p=>{let y;if(p.numberOfDays&&p.numberOfTraces)y={maxDaysOrCount:{maxDays:p.numberOfDays,maxCount:p.numberOfTraces}};else if(p.numberOfDays)y={maxDays:{maxDays:p.numberOfDays}};else if(p.numberOfTraces)y={maxCount:{maxCount:p.numberOfTraces}};else throw new Error("Invalid retention policy rule");i({variables:{input:{id:n.policyId,cronExpression:p.schedule,rule:y,name:p.name}},onCompleted:()=>{a({title:"Retention policy updated successfully",message:"The retention policy has been updated successfully."}),n.onEditCompleted()},onError:()=>{l({title:"Error updating retention policy",message:"Please try again."})}})},isSubmitting:r,mode:"edit",defaultValues:{name:t.retentionPolicy.name??"New Policy",schedule:t.retentionPolicy.cronExpression??"0 0 * * 0",numberOfDays:(d=t.retentionPolicy.rule)==null?void 0:d.maxDays,numberOfTraces:(c=t.retentionPolicy.rule)==null?void 0:c.maxCount},onCancel:n.onCancel})}const _0="Default",A0=({policyId:n,policyName:a,projectNames:l,onPolicyEdit:t,onPolicyDelete:i,connectionId:r})=>{const s=a!==_0,[d,c]=m.useState(null),p=m.useCallback(()=>{c(e(te,{size:"M",title:"Edit Retention Policy",children:e(m.Suspense,{fallback:e(ge,{}),children:e(L0,{policyId:n,onEditCompleted:()=>{t(),c(null)},onCancel:()=>{c(null)}})})}))},[t,n]),[y,u]=x.useMutation(Us),g=m.useCallback(()=>{c(o(te,{size:"S",title:"Delete Retention Policy",children:[o(v,{padding:"size-200",children:[e(C,{color:"danger",children:`Are you sure you want to delete retention policy "${a}"? This cannot be undone.`}),e("br",{}),l.length>0&&e(C,{color:"danger",children:`This policy is associated with the following projects: ${l.join(", ")}. These projects will fall back to the default policy.`})]}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",size:"S",onPress:()=>{y({variables:{policyId:n,connectionId:r}}),c(null),i()},isDisabled:u,leadingVisual:u?e(_,{svg:e(en,{})}):void 0,children:u?"Deleting...":"Delete Policy"})})})]}))},[n,a,l,y,i,u,r]);return o(Tl,{children:[o(zn,{buttonSize:"compact",disabledKeys:s?[]:["deletePolicy"],align:"end",onAction:f=>{switch(f){case"editPolicy":return p();case"deletePolicy":return g()}},children:[e(ue,{textValue:"Edit Policy",children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(Sa,{})}),e(C,{children:"Edit"})]})},"editPolicy"),e(ue,{textValue:"Delete Policy",children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(
|
|
498
|
+
`}}}();Gs.hash="3bf941d551e8fb7a6940d8774075be73";function L0(n){var d,c;const a=me(),l=ke(),t=x.useLazyLoadQuery(Gs,{id:n.policyId});if(!(t!=null&&t.retentionPolicy))throw new Error("Retention policy not found");const[i,r]=x.useMutation(Hs);return e(Os,{onSubmit:p=>{let y;if(p.numberOfDays&&p.numberOfTraces)y={maxDaysOrCount:{maxDays:p.numberOfDays,maxCount:p.numberOfTraces}};else if(p.numberOfDays)y={maxDays:{maxDays:p.numberOfDays}};else if(p.numberOfTraces)y={maxCount:{maxCount:p.numberOfTraces}};else throw new Error("Invalid retention policy rule");i({variables:{input:{id:n.policyId,cronExpression:p.schedule,rule:y,name:p.name}},onCompleted:()=>{a({title:"Retention policy updated successfully",message:"The retention policy has been updated successfully."}),n.onEditCompleted()},onError:()=>{l({title:"Error updating retention policy",message:"Please try again."})}})},isSubmitting:r,mode:"edit",defaultValues:{name:t.retentionPolicy.name??"New Policy",schedule:t.retentionPolicy.cronExpression??"0 0 * * 0",numberOfDays:(d=t.retentionPolicy.rule)==null?void 0:d.maxDays,numberOfTraces:(c=t.retentionPolicy.rule)==null?void 0:c.maxCount},onCancel:n.onCancel})}const _0="Default",A0=({policyId:n,policyName:a,projectNames:l,onPolicyEdit:t,onPolicyDelete:i,connectionId:r})=>{const s=a!==_0,[d,c]=m.useState(null),p=m.useCallback(()=>{c(e(te,{size:"M",title:"Edit Retention Policy",children:e(m.Suspense,{fallback:e(ge,{}),children:e(L0,{policyId:n,onEditCompleted:()=>{t(),c(null)},onCancel:()=>{c(null)}})})}))},[t,n]),[y,u]=x.useMutation(Us),g=m.useCallback(()=>{c(o(te,{size:"S",title:"Delete Retention Policy",children:[o(v,{padding:"size-200",children:[e(C,{color:"danger",children:`Are you sure you want to delete retention policy "${a}"? This cannot be undone.`}),e("br",{}),l.length>0&&e(C,{color:"danger",children:`This policy is associated with the following projects: ${l.join(", ")}. These projects will fall back to the default policy.`})]}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",size:"S",onPress:()=>{y({variables:{policyId:n,connectionId:r}}),c(null),i()},isDisabled:u,leadingVisual:u?e(_,{svg:e(en,{})}):void 0,children:u?"Deleting...":"Delete Policy"})})})]}))},[n,a,l,y,i,u,r]);return o(Tl,{children:[o(zn,{buttonSize:"compact",disabledKeys:s?[]:["deletePolicy"],align:"end",onAction:f=>{switch(f){case"editPolicy":return p();case"deletePolicy":return g()}},children:[e(ue,{textValue:"Edit Policy",children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(Sa,{})}),e(C,{children:"Edit"})]})},"editPolicy"),e(ue,{textValue:"Delete Policy",children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(Ge,{})}),e(C,{children:"Delete"})]})},"deletePolicy")]}),e(re,{type:"modal",isDismissable:!0,onDismiss:()=>c(null),children:d})]})},w0=qs,R0=({query:n})=>{const a=me(),l=mo(),{data:t}=x.usePaginationFragment(Bs,n),i=t.projectTraceRetentionPolicies.__id,r=t.projectTraceRetentionPolicies.edges.map(p=>{const y=p.node;return x.readInlineData(w0,y)}),s=m.useMemo(()=>{const p=[{header:"Name",accessorKey:"name"},{header:"Schedule",accessorKey:"cronExpression",cell:({row:y})=>Ri({schedule:y.original.cronExpression})},{header:"Rule",accessorKey:"rule",cell:({row:y})=>{const u=y.original.rule;if(u.__typename==="TraceRetentionRuleMaxCount")return`${u.maxCount} traces`;if(u.__typename==="TraceRetentionRuleMaxDays")return u.maxDays===0?"Infinite":`${u.maxDays} days`;if(u.__typename==="TraceRetentionRuleMaxDaysOrCount")return`${u.maxDays} days or ${u.maxCount} traces`;if(u.__typename==="%other")return"Unknown";Pe()}},{header:"Projects",accessorKey:"projects",cell:({row:y})=>e("ul",{css:F`
|
|
499
499
|
li {
|
|
500
500
|
display: inline;
|
|
501
501
|
}
|
|
502
502
|
li:not(:first-child):before {
|
|
503
503
|
content: ", ";
|
|
504
504
|
}
|
|
505
|
-
`,children:y.original.projects.edges.map(u=>e("li",{children:e(we,{to:`/projects/${u.node.id}/config`,children:u.node.name})},u.node.id))})}];return l&&p.push({id:"actions",cell:({row:y})=>e(A0,{policyId:y.original.id,policyName:y.original.name,connectionId:i,projectNames:y.original.projects.edges.map(u=>u.node.name),onPolicyEdit:()=>{a({title:"Policy Updated",message:`Policy "${y.original.name}" was updated and will take effect shortly.`})},onPolicyDelete:()=>{a({title:"Policy deleted",message:`Policy "${y.original.name}" was deleted`})}})}),p},[l,a,i]),d=Ke({columns:s,data:r,getCoreRowModel:Te(),getSortedRowModel:ln()}),c=d.getRowModel().rows;return o("table",{css:
|
|
505
|
+
`,children:y.original.projects.edges.map(u=>e("li",{children:e(we,{to:`/projects/${u.node.id}/config`,children:u.node.name})},u.node.id))})}];return l&&p.push({id:"actions",cell:({row:y})=>e(A0,{policyId:y.original.id,policyName:y.original.name,connectionId:i,projectNames:y.original.projects.edges.map(u=>u.node.name),onPolicyEdit:()=>{a({title:"Policy Updated",message:`Policy "${y.original.name}" was updated and will take effect shortly.`})},onPolicyDelete:()=>{a({title:"Policy deleted",message:`Policy "${y.original.name}" was deleted`})}})}),p},[l,a,i]),d=Ke({columns:s,data:r,getCoreRowModel:Te(),getSortedRowModel:ln()}),c=d.getRowModel().rows;return o("table",{css:He,children:[e("thead",{children:d.getHeaderGroups().map(p=>e("tr",{children:p.headers.map(y=>e("th",{colSpan:y.colSpan,children:y.isPlaceholder?null:e("div",{children:W(y.column.columnDef.header,y.getContext())})},y.id))},p.id))}),e("tbody",{children:c.map(p=>e("tr",{children:p.getVisibleCells().map(y=>e("td",{children:W(y.column.columnDef.cell,y.getContext())},y.id))},p.id))})]})};function XK(){const n=Me();je(n);const a=n.__id;return e(B,{title:"Retention Policies",bodyStyle:{padding:0},variant:"compact",extra:e(go,{children:o(Ue,{children:[e(E,{size:"S",leadingVisual:e(_,{svg:e(da,{})}),children:"New Policy"}),e(yn,{children:e(pn,{children:({close:l})=>o(J,{children:[e(ae,{slot:"title",children:"New Retention Policy"}),e(D0,{queryId:a,onCreate:()=>{l()}})]})})})]})}),children:e(R0,{query:n})})}const Ws=function(){var n={defaultValue:null,kind:"LocalArgument",name:"description"},a={defaultValue:null,kind:"LocalArgument",name:"expiresAt"},l={defaultValue:null,kind:"LocalArgument",name:"name"},t=[{fields:[{kind:"Variable",name:"description",variableName:"description"},{kind:"Variable",name:"expiresAt",variableName:"expiresAt"},{kind:"Variable",name:"name",variableName:"name"}],kind:"ObjectValue",name:"input"}],i={alias:null,args:null,kind:"ScalarField",name:"jwt",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},s={alias:null,args:null,concreteType:"SystemApiKey",kind:"LinkedField",name:"apiKey",plural:!1,selections:[r],storageKey:null};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"APIKeysCardCreateSystemAPIKeyMutation",selections:[{alias:null,args:t,concreteType:"CreateSystemApiKeyMutationPayload",kind:"LinkedField",name:"createSystemApiKey",plural:!1,selections:[i,{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"SystemAPIKeysTableFragment"}],storageKey:null},s],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[l,n,a],kind:"Operation",name:"APIKeysCardCreateSystemAPIKeyMutation",selections:[{alias:null,args:t,concreteType:"CreateSystemApiKeyMutationPayload",kind:"LinkedField",name:"createSystemApiKey",plural:!1,selections:[i,{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:null,concreteType:"SystemApiKey",kind:"LinkedField",name:"systemApiKeys",plural:!0,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null}],storageKey:null},s],storageKey:null}]},params:{cacheID:"799e8f0a627c6ae06e2a87c051d299d0",id:null,metadata:{},name:"APIKeysCardCreateSystemAPIKeyMutation",operationKind:"mutation",text:`mutation APIKeysCardCreateSystemAPIKeyMutation(
|
|
506
506
|
$name: String!
|
|
507
507
|
$description: String = null
|
|
508
508
|
$expiresAt: DateTime = null
|
|
@@ -576,7 +576,7 @@ fragment SystemAPIKeysTableFragment on Query {
|
|
|
576
576
|
expiresAt
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
`}};Xs.hash="de0fc04de739f0adfcbdeaff28b16265";const Ys={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:Xs}},name:"SystemAPIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"SystemApiKey",kind:"LinkedField",name:"systemApiKeys",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};Ys.hash="de0fc04de739f0adfcbdeaff28b16265";function E0({query:n}){const[a,l]=x.useRefetchableFragment(Ys,n),t=ke(),i=me(),[r]=x.useMutation(Zs),s=m.useCallback(g=>{r({variables:{input:{id:g}},onCompleted:()=>{i({title:"System key deleted",message:"The system key has been deleted and is no longer active."}),m.startTransition(()=>{l({},{fetchPolicy:"network-only"})})},onError:f=>{const k=
|
|
579
|
+
`}};Xs.hash="de0fc04de739f0adfcbdeaff28b16265";const Ys={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:Xs}},name:"SystemAPIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"SystemApiKey",kind:"LinkedField",name:"systemApiKeys",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};Ys.hash="de0fc04de739f0adfcbdeaff28b16265";function E0({query:n}){const[a,l]=x.useRefetchableFragment(Ys,n),t=ke(),i=me(),[r]=x.useMutation(Zs),s=m.useCallback(g=>{r({variables:{input:{id:g}},onCompleted:()=>{i({title:"System key deleted",message:"The system key has been deleted and is no longer active."}),m.startTransition(()=>{l({},{fetchPolicy:"network-only"})})},onError:f=>{const k=Ie(f);t({title:"Error deleting system key",message:(k==null?void 0:k[0])??f.message})}})},[r,t,i,l]),d=m.useMemo(()=>[...a.systemApiKeys],[a]),c=m.useMemo(()=>[{header:"Name",accessorKey:"name"},{header:"Description",accessorKey:"description",cell:Ee},{header:"Created At",accessorKey:"createdAt",cell:_e},{header:"Expires At",accessorKey:"expiresAt",cell:_e},{header:"",accessorKey:"id",size:10,cell:({row:f})=>e(b,{direction:"row",justifyContent:"end",width:"100%",children:e(yi,{handleDelete:()=>{s(f.original.id)}})}),meta:{textAlign:"right"}}],[s]),p=Ke({columns:c,data:d,getCoreRowModel:Te()}),y=p.getRowModel().rows,u=p.getRowModel().rows.length===0;return o("table",{css:He,children:[e("thead",{children:p.getHeaderGroups().map(g=>e("tr",{children:g.headers.map(f=>e("th",{colSpan:f.colSpan,children:f.isPlaceholder?null:o("div",{className:f.column.getCanSort()?"cursor-pointer":"",onClick:f.column.getToggleSortingHandler(),style:{left:f.getStart(),width:f.getSize()},children:[W(f.column.columnDef.header,f.getContext()),f.column.getIsSorted()?e(_,{className:"sort-icon",svg:f.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]})},f.id))},g.id))}),u?e(tn,{message:"No Keys"}):e("tbody",{children:y.map(g=>e("tr",{children:g.getVisibleCells().map(f=>e("td",{children:W(f.column.columnDef.cell,f.getContext())},f.id))},g.id))})]})}const ed=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"DeleteApiKeyMutationPayload",kind:"LinkedField",name:"deleteUserApiKey",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"apiKeyId",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"UserAPIKeysTableDeleteAPIKeyMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"UserAPIKeysTableDeleteAPIKeyMutation",selections:a},params:{cacheID:"d137498515ff43864f5525b3c1847376",id:null,metadata:{},name:"UserAPIKeysTableDeleteAPIKeyMutation",operationKind:"mutation",text:`mutation UserAPIKeysTableDeleteAPIKeyMutation(
|
|
580
580
|
$input: DeleteApiKeyInput!
|
|
581
581
|
) {
|
|
582
582
|
deleteUserApiKey(input: $input) {
|
|
@@ -601,7 +601,7 @@ fragment UserAPIKeysTableFragment on Query {
|
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
|
-
`}}}();nd.hash="c2b3a579bcb0ba915523ecb35cae3b44";const ad={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:nd}},name:"UserAPIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"userApiKeys",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};ad.hash="c2b3a579bcb0ba915523ecb35cae3b44";const Kr=70;function M0({query:n}){const[a,l]=x.useRefetchableFragment(ad,n),t=ke(),i=me(),[r]=x.useMutation(ed),s=m.useCallback(g=>{r({variables:{input:{id:g}},onCompleted:()=>{i({title:"User key deleted",message:"The user key has been deleted and is no longer active."}),m.startTransition(()=>{l({},{fetchPolicy:"network-only"})})},onError:f=>{const k=
|
|
604
|
+
`}}}();nd.hash="c2b3a579bcb0ba915523ecb35cae3b44";const ad={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:nd}},name:"UserAPIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"userApiKeys",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};ad.hash="c2b3a579bcb0ba915523ecb35cae3b44";const Kr=70;function M0({query:n}){const[a,l]=x.useRefetchableFragment(ad,n),t=ke(),i=me(),[r]=x.useMutation(ed),s=m.useCallback(g=>{r({variables:{input:{id:g}},onCompleted:()=>{i({title:"User key deleted",message:"The user key has been deleted and is no longer active."}),m.startTransition(()=>{l({},{fetchPolicy:"network-only"})})},onError:f=>{const k=Ie(f);t({title:"Error deleting user key",message:(k==null?void 0:k[0])??f.message})}})},[r,t,i,l]),d=m.useMemo(()=>[...a.userApiKeys],[a]),c=m.useMemo(()=>[{header:"Name",accessorKey:"name",size:100,cell:Ee},{header:"Description",accessorKey:"description",cell:Ee},{header:"Created At",accessorKey:"createdAt",size:Kr,cell:_e},{header:"Expires At",accessorKey:"expiresAt",size:Kr,cell:_e},{header:"User",size:120,accessorKey:"user.email",cell:Ee},{header:"",accessorKey:"id",size:10,cell:({row:f})=>e(b,{direction:"row",justifyContent:"end",width:"100%",children:e(yi,{handleDelete:()=>{s(f.original.id)}})}),meta:{textAlign:"right"}}],[s]),p=Ke({columns:c,data:d,getCoreRowModel:Te()}),y=p.getRowModel().rows,u=p.getRowModel().rows.length===0;return o("table",{css:He,children:[e("thead",{children:p.getHeaderGroups().map(g=>e("tr",{children:g.headers.map(f=>e("th",{colSpan:f.colSpan,children:f.isPlaceholder?null:o("div",{className:f.column.getCanSort()?"cursor-pointer":"",onClick:f.column.getToggleSortingHandler(),style:{left:f.getStart(),width:f.getSize()},children:[W(f.column.columnDef.header,f.getContext()),f.column.getIsSorted()?e(_,{className:"sort-icon",svg:f.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]})},f.id))},g.id))}),u?e(tn,{message:"No Keys"}):e("tbody",{children:y.map(g=>e("tr",{children:g.getVisibleCells().map(f=>e("td",{children:W(f.column.columnDef.cell,f.getContext())},f.id))},g.id))})]})}function V0(){const n=x.useLazyLoadQuery(Js,{},{fetchPolicy:"network-only"});return o(an,{children:[o(nn,{children:[e(ne,{id:"system",children:"System Keys"}),e(ne,{id:"user",children:"User Keys"})]}),e(oe,{id:"system",children:e(E0,{query:n})}),e(oe,{id:"user",children:e(M0,{query:n})})]})}function z0(){const[n,a]=m.useState(null),l=ke(),t=c=>{a(e(po,{jwt:c}))},[i,r]=x.useMutation(Ws),s=m.useCallback(c=>{var p;i({variables:{...c,expiresAt:((p=c.expiresAt)==null?void 0:p.toDate(ti()).toISOString())||null},onCompleted:y=>{t(y.createSystemApiKey.jwt)},onError:y=>{l({title:"Error creating system key",message:y.message})}})},[i,l]);return o("div",{children:[e(oi,{title:"API Keys",variant:"compact",extra:e(E,{size:"S",leadingVisual:e(_,{svg:e(Nn,{})}),onPress:()=>{a(e(yo,{onSubmit:s,isCommitting:r,defaultName:"System"}))},children:"System Key"}),children:e(m.Suspense,{fallback:e(v,{padding:"size-100",children:e(ge,{})}),children:e(V0,{})})}),e(re,{onDismiss:()=>{a(null)},children:n})]})}const ld={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"DBUsagePieChart_data",selections:[{alias:null,args:null,concreteType:"DbTableStats",kind:"LinkedField",name:"dbTableStats",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"tableName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"numBytes",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dbStorageCapacityBytes",storageKey:null}],type:"Query",abstractKey:null};ld.hash="922bf6de312a4be0c38025ffbb868d6d";function td(n,a){const{si:l=!1,decimalPlaces:t=1}={},i=l?1e3:1024;if(Math.abs(n)<i)return n+" B";const r=l?["kB","MB","GB","TB","PB","EB","ZB","YB"]:["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];let s=-1;const d=10**t;do n/=i,++s;while(Math.round(Math.abs(n)*d)/d>=i&&s<r.length-1);return n.toFixed(t)+" "+r[s]}const Tr="remaining";function N0({active:n,payload:a}){return n&&a&&a.length?e(Gn,{children:e(qe,{shape:"square",color:a[0].payload.fill||"transparent",name:a[0].name||"--",value:td(a[0].value||0)})}):null}function $0({query:n}){const a=x.useFragment(ld,n),l=a.dbTableStats.reduce((r,s)=>r+s.numBytes,0),t=typeof a.dbStorageCapacityBytes=="number"?a.dbStorageCapacityBytes-l:null,i=m.useMemo(()=>{const r=[...a.dbTableStats];return t!==null&&r.push({tableName:Tr,numBytes:t}),r},[a.dbTableStats,t]);return e(On,{width:"100%",height:245,children:o(ds,{children:[e(os,{data:i,dataKey:"numBytes",nameKey:"tableName",cx:"50%",cy:"50%",innerRadius:70,outerRadius:110,strokeWidth:0,stroke:"transparent",children:i.map((r,s)=>e(ss,{stroke:"0",fill:r.tableName===Tr?"var(--ac-global-color-grey-200)":`${nr[s%nr.length]}`},`cell-${s}`))}),e(ea,{content:e(N0,{})}),e("text",{x:"50%",y:"50%",textAnchor:"middle",fill:"var(--ac-global-text-color-900",fontSize:"var(--ac-global-font-size-xl)",children:`${typeof a.dbStorageCapacityBytes=="number"?ql(l/a.dbStorageCapacityBytes*100):td(l)}`}),e("text",{x:"50%",y:"50%",dy:25,textAnchor:"middle",fill:"var(--ac-global-text-color-900",fontSize:"var(--ac-global-font-size-s)",children:"Used"}),e("g",{children:e("text",{x:"100%",y:"100%",dx:-80,dy:-2,textAnchor:"right",fill:"var(--ac-global-text-color-500)",fontSize:"var(--ac-global-font-size-xs)",children:"* approximate"})})]})})}const id=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"ProjectTraceRetentionPolicyMutationPayload",kind:"LinkedField",name:"patchProjectTraceRetentionPolicy",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"maxDays",storageKey:null}],type:"TraceRetentionRuleMaxDays",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"GlobalRetentionPolicyCardMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"GlobalRetentionPolicyCardMutation",selections:a},params:{cacheID:"096e3d4c546229fc771e14be03b168a3",id:null,metadata:{},name:"GlobalRetentionPolicyCardMutation",operationKind:"mutation",text:`mutation GlobalRetentionPolicyCardMutation(
|
|
605
605
|
$input: PatchProjectTraceRetentionPolicyInput!
|
|
606
606
|
) {
|
|
607
607
|
patchProjectTraceRetentionPolicy(input: $input) {
|
|
@@ -690,14 +690,14 @@ fragment UsersTable_users on Query {
|
|
|
690
690
|
) {
|
|
691
691
|
deleteUsers(input: $input)
|
|
692
692
|
}
|
|
693
|
-
`}}}();ud.hash="a718ceab0ec0a7d461f6cd5e5b178a1f";function Q0({userId:n,onDeleted:a,onClose:l}){const[t,i]=x.useMutation(ud),r=me(),s=ke(),d=m.useCallback(()=>{t({variables:{input:{userIds:[n]}},onCompleted:()=>{r({title:"User deleted",message:"User has been deleted."}),a(),l()},onError:c=>{const p=
|
|
693
|
+
`}}}();ud.hash="a718ceab0ec0a7d461f6cd5e5b178a1f";function Q0({userId:n,onDeleted:a,onClose:l}){const[t,i]=x.useMutation(ud),r=me(),s=ke(),d=m.useCallback(()=>{t({variables:{input:{userIds:[n]}},onCompleted:()=>{r({title:"User deleted",message:"User has been deleted."}),a(),l()},onError:c=>{const p=Ie(c);s({title:"Failed to delete user",message:(p==null?void 0:p[0])??c.message})}})},[t,s,r,l,a,n]);return o(te,{title:"Delete User",isDismissable:!0,onDismiss:l,children:[e(v,{padding:"size-200",children:e(C,{color:"danger",children:"Are you sure you want to delete this user? This action cannot be undone."})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:o(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",onPress:l,children:"Cancel"}),e(E,{variant:"danger",onPress:()=>{d()},isDisabled:i,children:"Delete user"})]})})]})}const md=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchUser",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ResetPasswordDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ResetPasswordDialogMutation",selections:a},params:{cacheID:"6ccff8dd53d97eeb41f656bcd2758da1",id:null,metadata:{},name:"ResetPasswordDialogMutation",operationKind:"mutation",text:`mutation ResetPasswordDialogMutation(
|
|
694
694
|
$input: PatchUserInput!
|
|
695
695
|
) {
|
|
696
696
|
patchUser(input: $input) {
|
|
697
697
|
__typename
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
|
-
`}}}();md.hash="85b22da61ec094c28e97db2759622b69";const al=4;function B0({userId:n,onClose:a}){const l=ke(),t=me(),[i,r]=x.useMutation(md),{control:s,handleSubmit:d,formState:{isDirty:c}}=Ve({defaultValues:{newPassword:"",confirmPassword:""}}),p=m.useCallback(y=>{i({variables:{input:{userId:n,newPassword:y.newPassword}},onCompleted:()=>{t({title:"Password reset",message:"Users password has been reset."}),a()},onError:u=>{l({title:"Failed to reset password",message:u.message})}})},[i,l,t,a,n]);return e(te,{title:"Reset Password",isDismissable:!0,onDismiss:a,children:e(Ye,{children:o(v,{padding:"size-200",children:[o(b,{direction:"column",gap:"size-100",children:[e(H,{name:"newPassword",control:s,rules:{required:"Password is required",minLength:{value:al,message:`Password must be at least ${al} characters`}},render:({field:{name:y,onChange:u,onBlur:g,value:f},fieldState:{invalid:k,error:h}})=>o(X,{isInvalid:k,onChange:u,name:y,onBlur:g,value:f.toString(),type:"password",id:"new-password",autoComplete:"new-password",children:[e(G,{children:"New Password"}),e(Z,{placeholder:"New password"}),h!=null&&h.message?e(Se,{children:h.message}):o(C,{slot:"description",children:["Password must be at least ",al," characters"]})]})}),e(H,{name:"confirmPassword",control:s,rules:{required:"Password is required",minLength:{value:al,message:`Password must be at least ${al} characters`},validate:(y,u)=>y===u.newPassword||"Passwords do not match"},render:({field:{name:y,onChange:u,onBlur:g,value:f},fieldState:{invalid:k,error:h}})=>o(X,{isInvalid:k,onChange:u,name:y,onBlur:g,value:f.toString(),type:"password",children:[e(G,{children:"Confirm Password"}),e(Z,{placeholder:"Repeat new password"}),h!=null&&h.message?e(Se,{children:h.message}):e(C,{slot:"description",children:"Repeat new password to confirm"})]})})]}),e(v,{paddingTop:"size-200",children:e(b,{direction:"row",gap:"size-100",justifyContent:"end",children:e(E,{variant:c?"primary":"default",type:"submit",isDisabled:r,onPress:()=>d(p)(),children:r?"Resetting...":"Reset Password"})})})]})})})}function q0(n){return n==="LOCAL"}function U0(n){const{userId:a,onUserDeleted:l,authMethod:t}=n,[i,r]=m.useState(null),s=m.useCallback(()=>{r(e(Q0,{userId:a,onClose:()=>r(null),onDeleted:()=>{l(),r(null)}}))},[a,l]),d=m.useCallback(()=>{r(e(B0,{userId:a,onClose:()=>r(null)}))},[a]),c=m.useMemo(()=>{const p=e(ue,{children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(
|
|
700
|
+
`}}}();md.hash="85b22da61ec094c28e97db2759622b69";const al=4;function B0({userId:n,onClose:a}){const l=ke(),t=me(),[i,r]=x.useMutation(md),{control:s,handleSubmit:d,formState:{isDirty:c}}=Ve({defaultValues:{newPassword:"",confirmPassword:""}}),p=m.useCallback(y=>{i({variables:{input:{userId:n,newPassword:y.newPassword}},onCompleted:()=>{t({title:"Password reset",message:"Users password has been reset."}),a()},onError:u=>{l({title:"Failed to reset password",message:u.message})}})},[i,l,t,a,n]);return e(te,{title:"Reset Password",isDismissable:!0,onDismiss:a,children:e(Ye,{children:o(v,{padding:"size-200",children:[o(b,{direction:"column",gap:"size-100",children:[e(H,{name:"newPassword",control:s,rules:{required:"Password is required",minLength:{value:al,message:`Password must be at least ${al} characters`}},render:({field:{name:y,onChange:u,onBlur:g,value:f},fieldState:{invalid:k,error:h}})=>o(X,{isInvalid:k,onChange:u,name:y,onBlur:g,value:f.toString(),type:"password",id:"new-password",autoComplete:"new-password",children:[e(G,{children:"New Password"}),e(Z,{placeholder:"New password"}),h!=null&&h.message?e(Se,{children:h.message}):o(C,{slot:"description",children:["Password must be at least ",al," characters"]})]})}),e(H,{name:"confirmPassword",control:s,rules:{required:"Password is required",minLength:{value:al,message:`Password must be at least ${al} characters`},validate:(y,u)=>y===u.newPassword||"Passwords do not match"},render:({field:{name:y,onChange:u,onBlur:g,value:f},fieldState:{invalid:k,error:h}})=>o(X,{isInvalid:k,onChange:u,name:y,onBlur:g,value:f.toString(),type:"password",children:[e(G,{children:"Confirm Password"}),e(Z,{placeholder:"Repeat new password"}),h!=null&&h.message?e(Se,{children:h.message}):e(C,{slot:"description",children:"Repeat new password to confirm"})]})})]}),e(v,{paddingTop:"size-200",children:e(b,{direction:"row",gap:"size-100",justifyContent:"end",children:e(E,{variant:c?"primary":"default",type:"submit",isDisabled:r,onPress:()=>d(p)(),children:r?"Resetting...":"Reset Password"})})})]})})})}function q0(n){return n==="LOCAL"}function U0(n){const{userId:a,onUserDeleted:l,authMethod:t}=n,[i,r]=m.useState(null),s=m.useCallback(()=>{r(e(Q0,{userId:a,onClose:()=>r(null),onDeleted:()=>{l(),r(null)}}))},[a,l]),d=m.useCallback(()=>{r(e(B0,{userId:a,onClose:()=>r(null)}))},[a]),c=m.useMemo(()=>{const p=e(ue,{children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(Ge,{})}),e(J,{children:"Delete"})]})},"deleteUser"),y=e(ue,{children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(fo,{})}),e(J,{children:"Reset Password"})]})},"resetPassword"),u=[p];return q0(t)&&u.push(y),u},[t]);return o("div",{onClick:p=>{p.preventDefault(),p.stopPropagation()},children:[e(zn,{align:"end","aria-label":"User Actions",buttonSize:"compact",onAction:p=>{switch(p){case"deleteUser":s();break;case"resetPassword":d();break}},children:c}),e(re,{type:"modal",isDismissable:!0,onDismiss:()=>r(null),children:i})]})}const gd=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchUser",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"UserRoleChangeDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"UserRoleChangeDialogMutation",selections:a},params:{cacheID:"44e970c967f83a0b7a6bd1cbafc3a936",id:null,metadata:{},name:"UserRoleChangeDialogMutation",operationKind:"mutation",text:`mutation UserRoleChangeDialogMutation(
|
|
701
701
|
$input: PatchUserInput!
|
|
702
702
|
) {
|
|
703
703
|
patchUser(input: $input) {
|
|
@@ -713,7 +713,7 @@ fragment UsersTable_users on Query {
|
|
|
713
713
|
}
|
|
714
714
|
`,J0=F`
|
|
715
715
|
height: ${G0}px;
|
|
716
|
-
`,Pr=n=>n.email==="admin@localhost"||n.username==="admin";function Z0({query:n}){const[a,l]=m.useState(null),[t,i]=x.useRefetchableFragment(cd,n),r=m.useMemo(()=>t.users.edges.map(({user:g})=>({id:g.id,email:g.email,username:g.username,profilePictureUrl:g.profilePictureUrl,createdAt:g.createdAt,role:g.role.name,authMethod:g.authMethod})),[t]),s=m.useCallback(()=>{m.startTransition(()=>{i({},{fetchPolicy:"network-only"})})},[i]),{viewer:d}=fi(),c=m.useMemo(()=>[{header:"user",accessorKey:"username",cell:({row:g})=>o(b,{direction:"row",gap:"size-50",alignItems:"center",children:[e(nt,{name:g.original.username,profilePictureUrl:g.original.profilePictureUrl,size:20}),e("span",{children:g.original.username}),e("a",{href:`mailto:${g.original.email}`,css:W0,children:g.original.email})]})},{header:"method",accessorKey:"authMethod",size:10,cell:({row:g})=>g.original.authMethod.toLowerCase()},{header:"role",accessorKey:"role",cell:({row:g})=>Pr(g.original)||d&&d.email==g.original.email?Ut(g.original.role):e(ry,{includeLabel:!1,onChange:f=>{f!==g.original.role&&l(e(H0,{onClose:()=>l(null),onRoleChanged:s,currentRole:g.original.role,newRole:f,email:g.original.email,userId:g.original.id}))},role:iy(g.original.role)?g.original.role:void 0})},{header:"created at",accessorKey:"createdAt",cell:_e},{header:"",accessorKey:"id",size:10,cell:({row:g})=>Pr(g.original)?null:e(b,{direction:"row",justifyContent:"end",width:"100%",children:e(U0,{userId:g.original.id,onUserDeleted:s,authMethod:g.original.authMethod})}),meta:{textAlign:"right"}}],[s,d]),p=Ke({columns:c,data:r,getCoreRowModel:Te(),getSortedRowModel:ln()}),y=p.getRowModel().rows,u=p.getRowModel().rows.length===0;return o("table",{css:
|
|
716
|
+
`,Pr=n=>n.email==="admin@localhost"||n.username==="admin";function Z0({query:n}){const[a,l]=m.useState(null),[t,i]=x.useRefetchableFragment(cd,n),r=m.useMemo(()=>t.users.edges.map(({user:g})=>({id:g.id,email:g.email,username:g.username,profilePictureUrl:g.profilePictureUrl,createdAt:g.createdAt,role:g.role.name,authMethod:g.authMethod})),[t]),s=m.useCallback(()=>{m.startTransition(()=>{i({},{fetchPolicy:"network-only"})})},[i]),{viewer:d}=fi(),c=m.useMemo(()=>[{header:"user",accessorKey:"username",cell:({row:g})=>o(b,{direction:"row",gap:"size-50",alignItems:"center",children:[e(nt,{name:g.original.username,profilePictureUrl:g.original.profilePictureUrl,size:20}),e("span",{children:g.original.username}),e("a",{href:`mailto:${g.original.email}`,css:W0,children:g.original.email})]})},{header:"method",accessorKey:"authMethod",size:10,cell:({row:g})=>g.original.authMethod.toLowerCase()},{header:"role",accessorKey:"role",cell:({row:g})=>Pr(g.original)||d&&d.email==g.original.email?Ut(g.original.role):e(ry,{includeLabel:!1,onChange:f=>{f!==g.original.role&&l(e(H0,{onClose:()=>l(null),onRoleChanged:s,currentRole:g.original.role,newRole:f,email:g.original.email,userId:g.original.id}))},role:iy(g.original.role)?g.original.role:void 0})},{header:"created at",accessorKey:"createdAt",cell:_e},{header:"",accessorKey:"id",size:10,cell:({row:g})=>Pr(g.original)?null:e(b,{direction:"row",justifyContent:"end",width:"100%",children:e(U0,{userId:g.original.id,onUserDeleted:s,authMethod:g.original.authMethod})}),meta:{textAlign:"right"}}],[s,d]),p=Ke({columns:c,data:r,getCoreRowModel:Te(),getSortedRowModel:ln()}),y=p.getRowModel().rows,u=p.getRowModel().rows.length===0;return o("table",{css:He,children:[e("thead",{children:p.getHeaderGroups().map(g=>e("tr",{children:g.headers.map(f=>e("th",{colSpan:f.colSpan,children:f.isPlaceholder?null:o("div",{className:f.column.getCanSort()?"cursor-pointer":"",onClick:f.column.getToggleSortingHandler(),style:{left:f.getStart(),width:f.getSize()},children:[W(f.column.columnDef.header,f.getContext()),f.column.getIsSorted()?e(_,{className:"sort-icon",svg:f.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]})},f.id))},g.id))}),u?e(tn,{}):e("tbody",{children:y.map(g=>e("tr",{css:J0,children:g.getVisibleCells().map(f=>e("td",{children:W(f.column.columnDef.cell,f.getContext())},f.id))},g.id))}),e(re,{onDismiss:()=>l(null),isDismissable:!0,type:"modal",children:a})]})}function X0(){const[n,a]=m.useState(0),[l,t]=m.useState(null),i=me(),r=ke(),s=x.useLazyLoadQuery(od,{},{fetchKey:n,fetchPolicy:"store-and-network"});return o(B,{title:"Users",variant:"compact",bodyStyle:{padding:0,overflowX:"auto"},extra:e(E,{onPress:()=>{t(e(O0,{onDismiss:()=>{t(null)},onNewUserCreated:d=>{t(null),i({title:"User added",message:`User ${d} has been added.`}),a(c=>c+1)},onNewUserCreationError:d=>{const c=Ie(d);r({title:"Error adding user",message:(c==null?void 0:c[0])??d.message})}}))},size:"S",leadingVisual:e(_,{svg:e(Nn,{})}),children:"Add User"}),children:[e(m.Suspense,{fallback:e(v,{padding:"size-200",children:e(ge,{})}),children:e(Z0,{query:s})}),e(re,{onDismiss:()=>{t(null)},children:l})]})}const Y0=F`
|
|
717
717
|
.ac-field {
|
|
718
718
|
// Hacky solution to make the text fields fill the remaining space
|
|
719
719
|
width: calc(100% - var(--ac-global-dimension-size-600));
|
|
@@ -996,7 +996,7 @@ fragment ProjectAnnotationConfigCardContent_project_annotations on Project {
|
|
|
996
996
|
width: fit-content;
|
|
997
997
|
`},n.original.name)},{id:"type",header:"Type",accessorKey:"annotationType",cell:({row:n})=>{var a,l;return e(C,{children:((a=n.original.annotationType)==null?void 0:a.charAt(0).toUpperCase())+((l=n.original.annotationType)==null?void 0:l.slice(1).toLowerCase())})}}],bk=n=>{const{projectId:a}=n,[l,t]=m.useState({}),i=me(),r=ke(),s=x.useLazyLoadQuery(Td,{projectId:a}),[d]=x.useRefetchableFragment(Kd,s.project),[c]=x.useMutation(Cd),[p]=x.useMutation(vd),y=m.useCallback(h=>{t(S=>({...S,[h]:!0})),m.startTransition(()=>{c({variables:{projectId:a,annotationConfigId:h},onCompleted:()=>{t(S=>({...S,[h]:!1})),i({title:"Annotation config added",message:"The annotation config has been added to the project."})},onError:S=>{t(K=>({...K,[h]:!1})),r({title:"Failed to add annotation config",message:S.message||"An unknown error occurred"})}})})},[a,c,i,r]),u=m.useCallback(h=>{t(S=>({...S,[h]:!0})),p({variables:{projectId:a,annotationConfigId:h},onCompleted:()=>{t(S=>({...S,[h]:!1})),i({title:"Annotation config removed",message:"The annotation config has been removed from the project."})},onError:S=>{t(K=>({...K,[h]:!1})),r({title:"Failed to remove annotation config",message:S.message||"An unknown error occurred"})}})},[a,p,i,r]),{allAnnotationConfigs:g}=s,f=m.useMemo(()=>{var S;const h=((S=d==null?void 0:d.annotationConfigs)==null?void 0:S.edges.map(K=>{var P;return(P=K==null?void 0:K.node)==null?void 0:P.name}))||[];return g.edges.map(K=>({id:K.node.id||"",name:K.node.name||"",annotationType:K.node.annotationType||"",isEnabled:h.includes(K.node.name),isLoading:l[K.node.id||""],onAdd:y,onRemove:u}))},[g.edges,d,l,y,u]),k=Ke({data:f,columns:kk,getCoreRowModel:Te()});return g.edges.length===0?e(b,{direction:"row",justifyContent:"center",children:e(C,{children:"No annotation configurations available."})}):e("div",{css:F`
|
|
998
998
|
overflow: auto;
|
|
999
|
-
`,children:o("table",{css:
|
|
999
|
+
`,children:o("table",{css:He,style:{width:k.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:k.getHeaderGroups().map(h=>e("tr",{children:h.headers.map(S=>e("th",{colSpan:S.colSpan,children:S.isPlaceholder?null:e("div",{style:{left:S.getStart(),width:S.getSize()},children:W(S.column.columnDef.header,S.getContext())})},S.id))},h.id))}),e("tbody",{children:k.getRowModel().rows.map(h=>e("tr",{children:h.getVisibleCells().map(S=>e("td",{style:{width:S.column.getSize(),maxWidth:S.column.getSize()},children:W(S.column.columnDef.cell,S.getContext())},S.id))},h.id))})]})})},Pd=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"cronExpression",storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"maxDays",storageKey:null},d={kind:"InlineFragment",selections:[s],type:"TraceRetentionRuleMaxDays",abstractKey:null},c={alias:null,args:null,kind:"ScalarField",name:"maxCount",storageKey:null},p={kind:"InlineFragment",selections:[c],type:"TraceRetentionRuleMaxCount",abstractKey:null},y={kind:"InlineFragment",selections:[s,c],type:"TraceRetentionRuleMaxDaysOrCount",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectPageQueriesProjectConfigQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{args:null,kind:"FragmentSpread",name:"ProjectConfigPage_projectConfigCard"},{args:null,kind:"FragmentSpread",name:"ProjectRetentionPolicyCard_policy"}],storageKey:null},{args:null,kind:"FragmentSpread",name:"ProjectRetentionPolicyCard_query"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectPageQueriesProjectConfigQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,l,{kind:"InlineFragment",selections:[i,{alias:null,args:null,kind:"ScalarField",name:"gradientStartColor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"gradientEndColor",storageKey:null},{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"traceRetentionPolicy",plural:!1,selections:[l,i,r,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[t,d,p,y],storageKey:null}],storageKey:null}],type:"Project",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicyConnection",kind:"LinkedField",name:"projectTraceRetentionPolicies",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicyEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ProjectTraceRetentionPolicy",kind:"LinkedField",name:"node",plural:!1,selections:[l,i,r,{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"rule",plural:!1,selections:[t,p,d,y],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"21b6f510ef6ac701854b1c2f750f30ad",id:null,metadata:{},name:"ProjectPageQueriesProjectConfigQuery",operationKind:"query",text:`query ProjectPageQueriesProjectConfigQuery(
|
|
1000
1000
|
$id: ID!
|
|
1001
1001
|
) {
|
|
1002
1002
|
project: node(id: $id) {
|
|
@@ -1501,7 +1501,7 @@ fragment PromptVersionTagsConfigCard_data on Prompt {
|
|
|
1501
1501
|
promptVersionId
|
|
1502
1502
|
}
|
|
1503
1503
|
}
|
|
1504
|
-
`}}}();zd.hash="14c6b4bb4ca5f20cce70677746b16459";const dT=async({params:n})=>{const a=n.promptId;if(!a)throw new Error("Prompt ID is required");return await x.fetchQuery(he,zd,{id:a}).toPromise()},Nd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptIndexPage__aside",selections:[{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptLatestVersionsListFragment"},{args:null,kind:"FragmentSpread",name:"EditPromptButton_data"}],type:"Prompt",abstractKey:null};Nd.hash="a77263d84d9add47173ed2e3d0243952";const $d={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptIndexPage__main",selections:[{alias:null,args:null,concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"PromptInvocationParameters__main"},{args:null,kind:"FragmentSpread",name:"PromptChatMessagesCard__main"},{args:null,kind:"FragmentSpread",name:"PromptCodeExportCard__main"},{args:null,kind:"FragmentSpread",name:"PromptModelConfigurationCard__main"}],storageKey:null}],storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptIndexPage__aside"}],type:"Prompt",abstractKey:null};$d.hash="a883b83f574448623a2b02a60d899d41";const jd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptModelConfigurationCard__main",selections:[{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptLLM__main"},{args:null,kind:"FragmentSpread",name:"PromptInvocationParameters__main"},{args:null,kind:"FragmentSpread",name:"PromptTools__main"},{args:null,kind:"FragmentSpread",name:"PromptResponseFormatFragment"}],type:"PromptVersion",abstractKey:null};jd.hash="1c4202299f1f881250b17b75244fac54";const Od={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptInvocationParameters__main",selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null}],type:"PromptVersion",abstractKey:null};Od.hash="4f00ab4f0396fffb81a1b068e544cfcf";function Pk({keyName:n,value:a}){const{json:l,stringifyError:t}=En(a);return t?null:e(v,{paddingStart:"size-100",paddingEnd:"size-100",children:o(b,{direction:"row",justifyContent:"space-between",children:[e(C,{size:"XS",color:"text-700",children:n}),e(C,{size:"XS",children:l})]})})}function xk({promptVersion:n}){const{invocationParameters:a}=x.useFragment(Od,n),l=m.useMemo(()=>mp(a)?Object.entries(a).map(([t,i])=>({key:t,value:i})):[],[a]);return l.length===0?e(v,{padding:"size-200",children:e(b,{justifyContent:"center",alignItems:"center",children:e(C,{color:"text-300",children:"No parameters saved for this prompt"})})}):e(Jl,{listSize:"small",children:l.map(({key:t,value:i},r)=>e(Wl,{children:e(Pk,{keyName:t,value:i})},`${t}-${r}`))})}const Qd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptLLM__main",selections:[{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null}],type:"PromptVersion",abstractKey:null};Qd.hash="acc90da43126218472d2fc19cd8d0512";const Dr=({keyName:n,children:a})=>e(Wl,{listSize:"small",children:e(v,{paddingStart:"size-100",paddingEnd:"size-100",children:o(b,{direction:"row",justifyContent:"space-between",children:[e(C,{size:"XS",color:"text-700",children:n}),e(C,{size:"XS",children:a})]})})});function Ik({promptVersion:n}){const a=x.useFragment(Qd,n);return o(fe,{id:"llm",children:[e(pe,{children:"LLM"}),e(ye,{children:o(Jl,{listSize:"small",children:[e(Dr,{keyName:"Model",children:a.model}),e(Dr,{keyName:"Provider",children:Gt[a.provider]??a.provider})]})})]})}const Bd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptResponseFormatFragment",selections:[{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],storageKey:null}],type:"PromptVersion",abstractKey:null};Bd.hash="154d745ec5e978e0dfc811ebfb9faa8c";function Dk({promptVersion:n}){const{responseFormat:a}=x.useFragment(Bd,n),l=m.useMemo(()=>typeof(a==null?void 0:a.definition)=="string"?En(Qe(a==null?void 0:a.definition).json||"",null,2).json||"":En(a==null?void 0:a.definition,null,2).json||"",[a==null?void 0:a.definition]);return l?o(fe,{id:"response-format",children:[e(pe,{children:"Response Format"}),e(ye,{children:e(
|
|
1504
|
+
`}}}();zd.hash="14c6b4bb4ca5f20cce70677746b16459";const dT=async({params:n})=>{const a=n.promptId;if(!a)throw new Error("Prompt ID is required");return await x.fetchQuery(he,zd,{id:a}).toPromise()},Nd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptIndexPage__aside",selections:[{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptLatestVersionsListFragment"},{args:null,kind:"FragmentSpread",name:"EditPromptButton_data"}],type:"Prompt",abstractKey:null};Nd.hash="a77263d84d9add47173ed2e3d0243952";const $d={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptIndexPage__main",selections:[{alias:null,args:null,concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"PromptInvocationParameters__main"},{args:null,kind:"FragmentSpread",name:"PromptChatMessagesCard__main"},{args:null,kind:"FragmentSpread",name:"PromptCodeExportCard__main"},{args:null,kind:"FragmentSpread",name:"PromptModelConfigurationCard__main"}],storageKey:null}],storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptIndexPage__aside"}],type:"Prompt",abstractKey:null};$d.hash="a883b83f574448623a2b02a60d899d41";const jd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptModelConfigurationCard__main",selections:[{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptLLM__main"},{args:null,kind:"FragmentSpread",name:"PromptInvocationParameters__main"},{args:null,kind:"FragmentSpread",name:"PromptTools__main"},{args:null,kind:"FragmentSpread",name:"PromptResponseFormatFragment"}],type:"PromptVersion",abstractKey:null};jd.hash="1c4202299f1f881250b17b75244fac54";const Od={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptInvocationParameters__main",selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null}],type:"PromptVersion",abstractKey:null};Od.hash="4f00ab4f0396fffb81a1b068e544cfcf";function Pk({keyName:n,value:a}){const{json:l,stringifyError:t}=En(a);return t?null:e(v,{paddingStart:"size-100",paddingEnd:"size-100",children:o(b,{direction:"row",justifyContent:"space-between",children:[e(C,{size:"XS",color:"text-700",children:n}),e(C,{size:"XS",children:l})]})})}function xk({promptVersion:n}){const{invocationParameters:a}=x.useFragment(Od,n),l=m.useMemo(()=>mp(a)?Object.entries(a).map(([t,i])=>({key:t,value:i})):[],[a]);return l.length===0?e(v,{padding:"size-200",children:e(b,{justifyContent:"center",alignItems:"center",children:e(C,{color:"text-300",children:"No parameters saved for this prompt"})})}):e(Jl,{listSize:"small",children:l.map(({key:t,value:i},r)=>e(Wl,{children:e(Pk,{keyName:t,value:i})},`${t}-${r}`))})}const Qd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptLLM__main",selections:[{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null}],type:"PromptVersion",abstractKey:null};Qd.hash="acc90da43126218472d2fc19cd8d0512";const Dr=({keyName:n,children:a})=>e(Wl,{listSize:"small",children:e(v,{paddingStart:"size-100",paddingEnd:"size-100",children:o(b,{direction:"row",justifyContent:"space-between",children:[e(C,{size:"XS",color:"text-700",children:n}),e(C,{size:"XS",children:a})]})})});function Ik({promptVersion:n}){const a=x.useFragment(Qd,n);return o(fe,{id:"llm",children:[e(pe,{children:"LLM"}),e(ye,{children:o(Jl,{listSize:"small",children:[e(Dr,{keyName:"Model",children:a.model}),e(Dr,{keyName:"Provider",children:Gt[a.provider]??a.provider})]})})]})}const Bd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptResponseFormatFragment",selections:[{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],storageKey:null}],type:"PromptVersion",abstractKey:null};Bd.hash="154d745ec5e978e0dfc811ebfb9faa8c";function Dk({promptVersion:n}){const{responseFormat:a}=x.useFragment(Bd,n),l=m.useMemo(()=>typeof(a==null?void 0:a.definition)=="string"?En(Qe(a==null?void 0:a.definition).json||"",null,2).json||"":En(a==null?void 0:a.definition,null,2).json||"",[a==null?void 0:a.definition]);return l?o(fe,{id:"response-format",children:[e(pe,{children:"Response Format"}),e(ye,{children:e(hn,{value:l})})]}):o(fe,{id:"response-format",children:[e(pe,{children:"Response Format"}),e(ye,{children:e(v,{padding:"size-200",children:e(b,{justifyContent:"center",alignItems:"center",children:e(C,{color:"text-300",children:"No response format specified for this prompt"})})})})]})}const qd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptTools__main",selections:[{alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],storageKey:null}],type:"PromptVersion",abstractKey:null};qd.hash="aa512d962d83a58b70ae0e17f01242b3";function Lk({promptVersion:n}){const{tools:a}=x.useFragment(qd,n),l=m.useMemo(()=>a.map((t,i)=>{const r=t.definition;return{name:Fy(r)||`Tool ${i+1}`,description:Cy(r)||void 0,definition:En(r,null,2).json||"{}"}}),[a]);return l.length===0?o(fe,{id:"tools",children:[e(pe,{children:"Tools"}),e(ye,{children:e(v,{padding:"size-200",children:e(b,{justifyContent:"center",alignItems:"center",children:e(C,{color:"text-300",children:"No tools specified for this prompt"})})})})]}):o(b,{direction:"column",children:[e(Ky,{bordered:!1,children:"Tools"}),e(bn,{css:F`
|
|
1505
1505
|
& {
|
|
1506
1506
|
> .ac-disclosure:last-child {
|
|
1507
1507
|
&[data-expanded="true"] {
|
|
@@ -1509,7 +1509,7 @@ fragment PromptVersionTagsConfigCard_data on Prompt {
|
|
|
1509
1509
|
}
|
|
1510
1510
|
}
|
|
1511
1511
|
}
|
|
1512
|
-
`,children:l.map((t,i)=>o(fe,{id:`tool-${i}`,children:[o(pe,{arrowPosition:"start",justifyContent:"space-between",children:[e(C,{children:t.name}),e(C,{children:t.description})]}),e(ye,{children:e(
|
|
1512
|
+
`,children:l.map((t,i)=>o(fe,{id:`tool-${i}`,children:[o(pe,{arrowPosition:"start",justifyContent:"space-between",children:[e(C,{children:t.name}),e(C,{children:t.description})]}),e(ye,{children:e(hn,{value:t.definition})})]},`${t.name}-${i}`))})]})}function Ud({promptVersion:n}){const a=x.useFragment(jd,n);return e(B,{title:"Model Configuration",variant:"compact",bodyStyle:{padding:0},collapsible:!0,children:o(bn,{defaultExpandedKeys:["llm","invocation-parameters","tools","response-format"],children:[e(Ik,{promptVersion:a}),o(fe,{id:"invocation-parameters",children:[e(pe,{children:"Invocation Parameters"}),e(ye,{children:e(xk,{promptVersion:a})})]}),e(Lk,{promptVersion:a}),e(Dk,{promptVersion:a})]})})}const Hd=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},s=[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],d={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"EditPromptButtonPatchPromptMutation",selections:[{alias:null,args:a,concreteType:"Prompt",kind:"LinkedField",name:"patchPrompt",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"PromptIndexPage__main"}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"EditPromptButtonPatchPromptMutation",selections:[{alias:null,args:a,concreteType:"Prompt",kind:"LinkedField",name:"patchPrompt",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null},{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[t,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null},i],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null},r,{alias:null,args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:s,storageKey:null},{alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:s,storageKey:null},{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},d,{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:5}],concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[r,d,{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:[r,i],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:"promptVersions(first:5)"},r],storageKey:null}]},params:{cacheID:"4c43e7052f5f6b399aee596f0f14da1b",id:null,metadata:{},name:"EditPromptButtonPatchPromptMutation",operationKind:"mutation",text:`mutation EditPromptButtonPatchPromptMutation(
|
|
1513
1513
|
$input: PatchPromptInput!
|
|
1514
1514
|
) {
|
|
1515
1515
|
patchPrompt(input: $input) {
|
|
@@ -1699,8 +1699,8 @@ fragment PromptVersionTagsList_data on PromptVersion {
|
|
|
1699
1699
|
name
|
|
1700
1700
|
}
|
|
1701
1701
|
}
|
|
1702
|
-
`}}}();Hd.hash="3ce25c8fbe5598ec1ee037a9778a6957";const Gd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"EditPromptButton_data",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null}],type:"Prompt",abstractKey:null};Gd.hash="24788aacf7830c0e5037befe576f4968";function _k(n){const[a,l]=m.useState(!1),t=me(),i=ke(),r=x.useFragment(Gd,n.prompt),[s,d]=x.useMutation(Hd),{control:c,handleSubmit:p}=Ve({defaultValues:{description:r.description??""}}),y=m.useCallback(u=>{s({variables:{input:{promptId:r.id,description:u.description}},onCompleted:()=>{l(!1),t({title:"Prompt updated",message:"The prompt has been updated successfully"})},onError:g=>{var f;i({title:"Error updating prompt",message:(f=De(g))==null?void 0:f[0]})}})},[r.id,s,i,t]);return o(Xe,{isOpen:a,onOpenChange:l,children:[e(E,{size:"S",leadingVisual:e(_,{svg:e(vo,{})}),variant:"quiet","aria-label":"configure prompt",onPress:()=>l(!0)}),e(kn,{size:"S",isDismissable:!0,children:o(pn,{children:[e(ae,{slot:"title",children:"Edit Prompt Details"}),o(Ye,{children:[e(v,{padding:"size-200",children:e(H,{name:"description",control:c,render:({field:u})=>o(X,{value:u.value,onChange:u.onChange,children:[e(G,{children:"Prompt Description"}),e(fa,{placeholder:"Enter a description for the prompt"}),e(C,{slot:"description",children:"A description of the prompt"})]})})}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:o(b,{direction:"row",gap:"size-100",justifyContent:"end",children:[e(E,{slot:"close",size:"S",children:"Cancel"}),e(E,{variant:"primary",size:"S",isDisabled:d,onPress:()=>p(y)(),children:d?"Saving...":"Save"})]})})]})]})})]})}const Wd=function(){var n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptChatMessagesCard__main",selections:[{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[a,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null}],type:"PromptVersion",abstractKey:null}}();Wd.hash="e0d9c12926330e5e774cbc64de158a82";const Mi=R.object({text:R.object({text:R.string()})}),Vi=R.object({toolCall:R.object({toolCallId:R.string(),toolCall:R.object({name:R.string(),arguments:R.string()})})}),zi=R.object({toolResult:R.object({toolCallId:R.string(),result:mi})}),Ft=n=>{const a=Mi.safeParse(n);return a.success?a.data:null},Jd=n=>{const a={text:{text:n}},l=Mi.safeParse(a);return l.success?l.data:null},Ni=n=>{const a=Vi.safeParse(n);return a.success?a.data:null},Zd=n=>{const a=Ty(n),l=Py(n),t=xy(n);if(!a)return null;const i=En(t).json||"",r={toolCall:{toolCallId:a,toolCall:{name:l||a,arguments:i}}},s=Vi.safeParse(r);return s.success?s.data:null},$i=n=>{const a=zi.safeParse(n);return a.success?a.data:null},Xd=(n,a)=>{const l={toolResult:{toolCallId:n,result:a}},t=zi.safeParse(l);return t.success?t.data:null};function Dl(n){return m.useMemo(()=>{const a=n.toLowerCase();return $l.user.includes(a)?{backgroundColor:"grey-200",borderColor:"grey-500"}:$l.ai.includes(a)?{backgroundColor:"blue-100",borderColor:"blue-700"}:$l.system.includes(a)?{backgroundColor:"indigo-100",borderColor:"indigo-700"}:["function","tool"].includes(a)?{backgroundColor:"yellow-100",borderColor:"yellow-700"}:{backgroundColor:"grey-100",borderColor:"grey-700"}},[n])}const Kt={text:"Text",toolCall:"Tool Call",toolResult:"Tool Result"},Ak=Object.values(Kt);function wk({toolResult:n,isOnlyChild:a}){const l=m.useMemo(()=>{const t=n.toolResult.result;return wi(t)},[n]);return e(ji,{title:Kt.toolResult,isOnlyChild:a,children:o(b,{direction:"column",children:[e(v,{paddingX:"size-200",paddingTop:"size-100",children:o(b,{direction:"column",justifyContent:"start",gap:"size-100",children:[e(C,{weight:"heavy",size:"XS",children:"Tool ID"}),e(v,{paddingX:"size-300",children:e(C,{size:"XS",children:n.toolResult.toolCallId})})]})}),o(b,{direction:"column",children:[e(v,{paddingX:"size-200",paddingTop:"size-100",children:e(C,{weight:"heavy",size:"XS",children:"Tool Result"})}),e(tt,{readOnly:!0,children:e(it,{readOnly:!0,height:"100%",defaultValue:l,templateFormat:yn.NONE})})]})]})})}function Rk({provider:n,toolCall:a,isOnlyChild:l}){const t=m.useMemo(()=>{const i=Co(a,n);return En(i,null,2).json||""},[n,a]);return e(ji,{title:Kt.toolCall,isOnlyChild:l,children:e(tt,{readOnly:!0,children:e(it,{readOnly:!0,height:"100%",defaultValue:t,templateFormat:yn.NONE})})})}function Ek(n){const{text:a,templateFormat:l,isOnlyChild:t}=n;return e(ji,{title:Kt.text,isOnlyChild:t,children:e(tt,{readOnly:!0,children:e(it,{readOnly:!0,height:"100%",defaultValue:a,templateFormat:l})})})}function ji({title:n,children:a,isOnlyChild:l}){return l?e(J,{children:a}):o(fe,{id:n,children:[e(pe,{children:e(C,{weight:"heavy",size:"S",children:n})}),e(ye,{children:a})]})}function Mk(n){const{role:a,children:l}=n,t=Dl(a);return e(B,{title:a,variant:"compact",...t,bodyStyle:{padding:0},collapsible:!0,children:e(bn,{defaultExpandedKeys:Ak,children:l})})}function Vk({promptVersion:n}){const{template:a,templateFormat:l,provider:t}=x.useFragment(Wd,n);if(a.__typename==="PromptStringTemplate")return e(C,{children:a.template});if(a.__typename==="PromptChatTemplate")return e(Nk,{template:a,templateFormat:l,provider:bs(t)||uo});if(a.__typename==="%other")throw new Error("Unknown template type"+a.__typename)}function zk({part:n,templateFormat:a,provider:l,isOnlyChild:t}){let i=Ft(n);return i?e(Ek,{text:i.text.text,templateFormat:a,isOnlyChild:t}):(i=Ni(n),i?e(Rk,{toolCall:i,provider:l,isOnlyChild:t}):(i=$i(n),i?e(wk,{toolResult:i,isOnlyChild:t}):null))}function Nk({template:n,templateFormat:a,provider:l}){const{messages:t}=n;return e(b,{direction:"column",gap:"size-100","data-testid":"chat-messages",children:t.map((i,r)=>{const s=i.content.length===1&&i.content.find(Ft)!=null;return e(Mk,{role:i.role,children:i.content.map((d,c)=>e(zk,{part:d,templateFormat:a,provider:l,isOnlyChild:s},`${c}-${d.__typename}`))},r)})})}function Yd({title:n="Prompt",promptVersion:a}){return e(B,{title:n,variant:"compact",collapsible:!0,"data-testid":"prompt-chat-messages-card",children:e(Vk,{promptVersion:a})})}const ec=function(){var n=[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],a={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptCodeExportCard__main",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:n,storageKey:null},{alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:n,storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[a,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[{kind:"InlineFragment",selections:[a,{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[a,{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[l,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null}],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[a,{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null}],type:"PromptVersion",abstractKey:null}}();ec.hash="3fa95713c234bb0cfa4c36e8e4f9cea0";const $k=R.enum(["system","user","assistant","developer","tool","function"]),Tt=R.object({role:$k,content:R.string().nullable(),name:R.string().optional(),tool_call_id:R.string().optional(),tool_calls:R.array(Iy).optional()}).passthrough(),jk=R.array(Tt);Gl(jk,{removeAdditionalStrategy:"passthrough"});const Ok=R.enum(["user","assistant","tool"]),Qk=Dy.extend({type:R.string(),text:R.string().optional(),id:R.string().optional(),tool_use_id:R.string().optional(),name:R.string().optional(),input:R.record(R.unknown()).optional(),source:R.object({type:R.string(),media_type:R.string().optional(),data:R.string().optional()}).optional()}),nc=R.object({role:Ok,content:R.union([R.string(),R.array(Qk)])}),Bk=R.array(nc);Gl(Bk,{removeAdditionalStrategy:"passthrough"});const qk=R.enum(["SYSTEM","USER","AI","TOOL"]),Uk=R.object({image:R.object({url:R.string()})}),Hk=R.discriminatedUnion("__typename",[Mi.extend({__typename:R.literal("TextContentPart")}),Uk.extend({__typename:R.literal("ImageContentPart")}),Vi.extend({__typename:R.literal("ToolCallContentPart")}),zi.extend({__typename:R.literal("ToolResultContentPart")})]),Pt=R.object({role:qk,content:R.array(Hk)}).passthrough(),Gk=R.array(Pt);Gl(Gk,{removeAdditionalStrategy:"passthrough"});const ac=Tt.transform(n=>{const a={role:n.role==="assistant"?"assistant":"user",content:n.content?[{type:"text",text:n.content}]:[]};return n.tool_calls?{...a,content:[...a.content,...n.tool_calls.map(l=>Ly.parse(l))]}:n.tool_call_id?{...a,content:[{type:"tool_result",tool_use_id:n.tool_call_id,content:n.content}]}:a}),lc=Pt.transform(n=>{if(n.role==="TOOL"){const t=n.content.map(i=>$i(i)).find(i=>!!i);if(!t)throw new Error("TOOL role message must have a ToolResultContentPart");return{role:"tool",content:wi(t.toolResult.result),tool_call_id:t.toolResult.toolCallId}}const a={role:{SYSTEM:"system",USER:"user",AI:"assistant",TOOL:"tool"}[n.role],content:n.content.map(t=>Ft(t)).filter(t=>!!t).map(t=>t.text.text).join(`
|
|
1703
|
-
`)},l=n.content.map(t=>Ni(t)).filter(t=>!!t).map(t=>({id:t.toolCall.toolCallId,type:"function",function:{name:t.toolCall.toolCall.name,arguments:typeof t.toolCall.toolCall.arguments=="string"?JSON.parse(t.toolCall.toolCall.arguments):t.toolCall.toolCall.arguments}}));return l.length>0?{...a,tool_calls:l}:a});Tt.transform(n=>{const a=[];if(n.role==="tool"&&n.tool_call_id){const t=Xd(n.tool_call_id,n.content);return t&&a.push({__typename:"ToolResultContentPart",...t}),{role:"TOOL",content:a}}if(n.content){const t=Jd(n.content);t&&a.push({__typename:"TextContentPart",...t})}return n.tool_calls&&n.tool_calls.forEach(t=>{const i=Zd({id:t.id,name:t.function.name,arguments:t.function.arguments});i&&a.push({__typename:"ToolCallContentPart",...i})}),{role:{system:"SYSTEM",user:"USER",assistant:"AI",tool:"TOOL",developer:"SYSTEM",function:"TOOL"}[n.role],content:a}});const Wk=({message:n,targetProvider:a})=>{switch(a){case"AZURE_OPENAI":case"OPENAI":return n;case"ANTHROPIC":return ac.parse(n);case"GOOGLE":return n;default:return Pe()}};R.union([Tt,nc,Pt,mi]);Pt.transform(n=>ac.parse(lc.parse(n)));const An=" ",El=({json:n,level:a,removeKeyQuotes:l=!1})=>{const t=An.repeat(a);let i=JSON.stringify(n,null,An);return i=i.split(`
|
|
1702
|
+
`}}}();Hd.hash="3ce25c8fbe5598ec1ee037a9778a6957";const Gd={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"EditPromptButton_data",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null}],type:"Prompt",abstractKey:null};Gd.hash="24788aacf7830c0e5037befe576f4968";function _k(n){const[a,l]=m.useState(!1),t=me(),i=ke(),r=x.useFragment(Gd,n.prompt),[s,d]=x.useMutation(Hd),{control:c,handleSubmit:p}=Ve({defaultValues:{description:r.description??""}}),y=m.useCallback(u=>{s({variables:{input:{promptId:r.id,description:u.description}},onCompleted:()=>{l(!1),t({title:"Prompt updated",message:"The prompt has been updated successfully"})},onError:g=>{var f;i({title:"Error updating prompt",message:(f=Ie(g))==null?void 0:f[0]})}})},[r.id,s,i,t]);return o(Ue,{isOpen:a,onOpenChange:l,children:[e(E,{size:"S",leadingVisual:e(_,{svg:e(vo,{})}),variant:"quiet","aria-label":"configure prompt",onPress:()=>l(!0)}),e(yn,{size:"S",isDismissable:!0,children:o(pn,{children:[e(ae,{slot:"title",children:"Edit Prompt Details"}),o(Ye,{children:[e(v,{padding:"size-200",children:e(H,{name:"description",control:c,render:({field:u})=>o(X,{value:u.value,onChange:u.onChange,children:[e(G,{children:"Prompt Description"}),e(fa,{placeholder:"Enter a description for the prompt"}),e(C,{slot:"description",children:"A description of the prompt"})]})})}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:o(b,{direction:"row",gap:"size-100",justifyContent:"end",children:[e(E,{slot:"close",size:"S",children:"Cancel"}),e(E,{variant:"primary",size:"S",isDisabled:d,onPress:()=>p(y)(),children:d?"Saving...":"Save"})]})})]})]})})]})}const Wd=function(){var n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptChatMessagesCard__main",selections:[{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[a,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null}],type:"PromptVersion",abstractKey:null}}();Wd.hash="e0d9c12926330e5e774cbc64de158a82";const Mi=R.object({text:R.object({text:R.string()})}),Vi=R.object({toolCall:R.object({toolCallId:R.string(),toolCall:R.object({name:R.string(),arguments:R.string()})})}),zi=R.object({toolResult:R.object({toolCallId:R.string(),result:mi})}),Ft=n=>{const a=Mi.safeParse(n);return a.success?a.data:null},Jd=n=>{const a={text:{text:n}},l=Mi.safeParse(a);return l.success?l.data:null},Ni=n=>{const a=Vi.safeParse(n);return a.success?a.data:null},Zd=n=>{const a=Ty(n),l=Py(n),t=xy(n);if(!a)return null;const i=En(t).json||"",r={toolCall:{toolCallId:a,toolCall:{name:l||a,arguments:i}}},s=Vi.safeParse(r);return s.success?s.data:null},$i=n=>{const a=zi.safeParse(n);return a.success?a.data:null},Xd=(n,a)=>{const l={toolResult:{toolCallId:n,result:a}},t=zi.safeParse(l);return t.success?t.data:null};function Dl(n){return m.useMemo(()=>{const a=n.toLowerCase();return $l.user.includes(a)?{backgroundColor:"grey-200",borderColor:"grey-500"}:$l.ai.includes(a)?{backgroundColor:"blue-100",borderColor:"blue-700"}:$l.system.includes(a)?{backgroundColor:"indigo-100",borderColor:"indigo-700"}:["function","tool"].includes(a)?{backgroundColor:"yellow-100",borderColor:"yellow-700"}:{backgroundColor:"grey-100",borderColor:"grey-700"}},[n])}const Kt={text:"Text",toolCall:"Tool Call",toolResult:"Tool Result"},Ak=Object.values(Kt);function wk({toolResult:n,isOnlyChild:a}){const l=m.useMemo(()=>{const t=n.toolResult.result;return wi(t)},[n]);return e(ji,{title:Kt.toolResult,isOnlyChild:a,children:o(b,{direction:"column",children:[e(v,{paddingX:"size-200",paddingTop:"size-100",children:o(b,{direction:"column",justifyContent:"start",gap:"size-100",children:[e(C,{weight:"heavy",size:"XS",children:"Tool ID"}),e(v,{paddingX:"size-300",children:e(C,{size:"XS",children:n.toolResult.toolCallId})})]})}),o(b,{direction:"column",children:[e(v,{paddingX:"size-200",paddingTop:"size-100",children:e(C,{weight:"heavy",size:"XS",children:"Tool Result"})}),e(tt,{readOnly:!0,children:e(it,{readOnly:!0,height:"100%",defaultValue:l,templateFormat:fn.NONE})})]})]})})}function Rk({provider:n,toolCall:a,isOnlyChild:l}){const t=m.useMemo(()=>{const i=Co(a,n);return En(i,null,2).json||""},[n,a]);return e(ji,{title:Kt.toolCall,isOnlyChild:l,children:e(tt,{readOnly:!0,children:e(it,{readOnly:!0,height:"100%",defaultValue:t,templateFormat:fn.NONE})})})}function Ek(n){const{text:a,templateFormat:l,isOnlyChild:t}=n;return e(ji,{title:Kt.text,isOnlyChild:t,children:e(tt,{readOnly:!0,children:e(it,{readOnly:!0,height:"100%",defaultValue:a,templateFormat:l})})})}function ji({title:n,children:a,isOnlyChild:l}){return l?e(J,{children:a}):o(fe,{id:n,children:[e(pe,{children:e(C,{weight:"heavy",size:"S",children:n})}),e(ye,{children:a})]})}function Mk(n){const{role:a,children:l}=n,t=Dl(a);return e(B,{title:a,variant:"compact",...t,bodyStyle:{padding:0},collapsible:!0,children:e(bn,{defaultExpandedKeys:Ak,children:l})})}function Vk({promptVersion:n}){const{template:a,templateFormat:l,provider:t}=x.useFragment(Wd,n);if(a.__typename==="PromptStringTemplate")return e(C,{children:a.template});if(a.__typename==="PromptChatTemplate")return e(Nk,{template:a,templateFormat:l,provider:bs(t)||uo});if(a.__typename==="%other")throw new Error("Unknown template type"+a.__typename)}function zk({part:n,templateFormat:a,provider:l,isOnlyChild:t}){let i=Ft(n);return i?e(Ek,{text:i.text.text,templateFormat:a,isOnlyChild:t}):(i=Ni(n),i?e(Rk,{toolCall:i,provider:l,isOnlyChild:t}):(i=$i(n),i?e(wk,{toolResult:i,isOnlyChild:t}):null))}function Nk({template:n,templateFormat:a,provider:l}){const{messages:t}=n;return e(b,{direction:"column",gap:"size-100","data-testid":"chat-messages",children:t.map((i,r)=>{const s=i.content.length===1&&i.content.find(Ft)!=null;return e(Mk,{role:i.role,children:i.content.map((d,c)=>e(zk,{part:d,templateFormat:a,provider:l,isOnlyChild:s},`${c}-${d.__typename}`))},r)})})}function Yd({title:n="Prompt",promptVersion:a}){return e(B,{title:n,variant:"compact",collapsible:!0,"data-testid":"prompt-chat-messages-card",children:e(Vk,{promptVersion:a})})}const ec=function(){var n=[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],a={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptCodeExportCard__main",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:n,storageKey:null},{alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:n,storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[a,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[{kind:"InlineFragment",selections:[a,{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[a,{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[l,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null}],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[a,{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null}],type:"PromptVersion",abstractKey:null}}();ec.hash="3fa95713c234bb0cfa4c36e8e4f9cea0";const $k=R.enum(["system","user","assistant","developer","tool","function"]),Tt=R.object({role:$k,content:R.string().nullable(),name:R.string().optional(),tool_call_id:R.string().optional(),tool_calls:R.array(Iy).optional()}).passthrough(),jk=R.array(Tt);Gl(jk,{removeAdditionalStrategy:"passthrough"});const Ok=R.enum(["user","assistant","tool"]),Qk=Dy.extend({type:R.string(),text:R.string().optional(),id:R.string().optional(),tool_use_id:R.string().optional(),name:R.string().optional(),input:R.record(R.unknown()).optional(),source:R.object({type:R.string(),media_type:R.string().optional(),data:R.string().optional()}).optional()}),nc=R.object({role:Ok,content:R.union([R.string(),R.array(Qk)])}),Bk=R.array(nc);Gl(Bk,{removeAdditionalStrategy:"passthrough"});const qk=R.enum(["SYSTEM","USER","AI","TOOL"]),Uk=R.object({image:R.object({url:R.string()})}),Hk=R.discriminatedUnion("__typename",[Mi.extend({__typename:R.literal("TextContentPart")}),Uk.extend({__typename:R.literal("ImageContentPart")}),Vi.extend({__typename:R.literal("ToolCallContentPart")}),zi.extend({__typename:R.literal("ToolResultContentPart")})]),Pt=R.object({role:qk,content:R.array(Hk)}).passthrough(),Gk=R.array(Pt);Gl(Gk,{removeAdditionalStrategy:"passthrough"});const ac=Tt.transform(n=>{const a={role:n.role==="assistant"?"assistant":"user",content:n.content?[{type:"text",text:n.content}]:[]};return n.tool_calls?{...a,content:[...a.content,...n.tool_calls.map(l=>Ly.parse(l))]}:n.tool_call_id?{...a,content:[{type:"tool_result",tool_use_id:n.tool_call_id,content:n.content}]}:a}),lc=Pt.transform(n=>{if(n.role==="TOOL"){const t=n.content.map(i=>$i(i)).find(i=>!!i);if(!t)throw new Error("TOOL role message must have a ToolResultContentPart");return{role:"tool",content:wi(t.toolResult.result),tool_call_id:t.toolResult.toolCallId}}const a={role:{SYSTEM:"system",USER:"user",AI:"assistant",TOOL:"tool"}[n.role],content:n.content.map(t=>Ft(t)).filter(t=>!!t).map(t=>t.text.text).join(`
|
|
1703
|
+
`)},l=n.content.map(t=>Ni(t)).filter(t=>!!t).map(t=>({id:t.toolCall.toolCallId,type:"function",function:{name:t.toolCall.toolCall.name,arguments:typeof t.toolCall.toolCall.arguments=="string"?JSON.parse(t.toolCall.toolCall.arguments):t.toolCall.toolCall.arguments}}));return l.length>0?{...a,tool_calls:l}:a});Tt.transform(n=>{const a=[];if(n.role==="tool"&&n.tool_call_id){const t=Xd(n.tool_call_id,n.content);return t&&a.push({__typename:"ToolResultContentPart",...t}),{role:"TOOL",content:a}}if(n.content){const t=Jd(n.content);t&&a.push({__typename:"TextContentPart",...t})}return n.tool_calls&&n.tool_calls.forEach(t=>{const i=Zd({id:t.id,name:t.function.name,arguments:t.function.arguments});i&&a.push({__typename:"ToolCallContentPart",...i})}),{role:{system:"SYSTEM",user:"USER",assistant:"AI",tool:"TOOL",developer:"SYSTEM",function:"TOOL"}[n.role],content:a}});const Wk=({message:n,targetProvider:a})=>{switch(a){case"AZURE_OPENAI":case"OPENAI":case"DEEPSEEK":return n;case"ANTHROPIC":return ac.parse(n);case"GOOGLE":return n;default:return Pe()}};R.union([Tt,nc,Pt,mi]);Pt.transform(n=>ac.parse(lc.parse(n)));const An=" ",El=({json:n,level:a,removeKeyQuotes:l=!1})=>{const t=An.repeat(a);let i=JSON.stringify(n,null,An);return i=i.split(`
|
|
1704
1704
|
`).map((r,s)=>s>0?t+r:r).join(`
|
|
1705
1705
|
`),l&&(i=i.replace(/"([a-zA-Z_$][a-zA-Z0-9_$]*)"\s*:/g,"$1:")),i},Jk=Tn.template(`
|
|
1706
1706
|
from openai import OpenAI
|
|
@@ -1828,7 +1828,7 @@ const response = await anthropic.messages.create({
|
|
|
1828
1828
|
});
|
|
1829
1829
|
|
|
1830
1830
|
console.log(response.content);
|
|
1831
|
-
`.trim()),ra={python:{openai:{assignmentOperator:"=",removeKeyQuotes:!1,stringQuote:'"',sdkTemplate:Jk,clientTemplate:Xk},anthropic:{assignmentOperator:"=",removeKeyQuotes:!1,stringQuote:'"',sdkTemplate:e1,clientTemplate:a1}},typescript:{openai:{assignmentOperator:": ",removeKeyQuotes:!0,stringQuote:'"',sdkTemplate:Zk,clientTemplate:Yk},anthropic:{assignmentOperator:": ",removeKeyQuotes:!0,stringQuote:'"',sdkTemplate:n1,clientTemplate:l1}}},Ml=(n,a)=>{if(!("messages"in n.template))throw new Error("Prompt template does not contain messages");const l=[],{assignmentOperator:t,removeKeyQuotes:i,stringQuote:r}=a;if(n.modelName&&l.push(`model${t}${r}${n.modelName}${r}`),n.invocationParameters){const d=Object.entries(n.invocationParameters).map(([c,p])=>typeof p=="string"?`${c}${t}${r}${p}${r}`:gi(p)?`${c}${t}${El({json:p,level:1,removeKeyQuotes:i})}`:`${c}${t}${p}`);l.push(...d)}let s="";if(n.template.messages.length>0&&(s=El({json:n.template.messages,level:0,removeKeyQuotes:i}),l.push(t==="="?"messages=messages":"messages")),n.tools&&n.tools.length>0){const d=El({json:n.tools.map(c=>c.definition),level:1,removeKeyQuotes:i});l.push(`tools${t}${d}`)}if(n.responseFormat&&"definition"in n.responseFormat){const d=El({json:n.responseFormat.definition,level:1,removeKeyQuotes:i});l.push(`response_format${t}${d}`)}return{args:l,messages:s}},Lr=n=>"tool_calls"in n&&n.tool_calls?{...n,tool_calls:n.tool_calls.map(a=>({...a,function:{...a.function,arguments:JSON.stringify(a.function.arguments)}}))}:n,t1={python:{openai:n=>{const a=ra.python.openai,l={...n,template:{...n.template,messages:n.template.messages.map(r=>Lr(r))}},{args:t,messages:i}=Ml(l,a);return a.sdkTemplate({tab:An,args:t,messages:i})},anthropic:n=>{const a=ra.python.anthropic,{args:l,messages:t}=Ml(n,a);return a.sdkTemplate({tab:An,args:l,messages:t})}},typescript:{openai:n=>{const a=ra.typescript.openai,l={...n,template:{...n.template,messages:n.template.messages.map(r=>Lr(r))}},{args:t,messages:i}=Ml(l,a);return a.sdkTemplate({tab:An,args:t,messages:i})},anthropic:n=>{const a=ra.typescript.anthropic,{args:l,messages:t}=Ml(n,a);return a.sdkTemplate({tab:An,args:l,messages:t})}}},i1={python:{openai:n=>ra.python.openai.clientTemplate({tab:An,versionId:n.versionId}),anthropic:n=>ra.python.openai.clientTemplate({tab:An,versionId:n.versionId})},typescript:{openai:n=>ra.typescript.openai.clientTemplate({tab:An,versionId:n.versionId}),anthropic:n=>ra.typescript.anthropic.clientTemplate({tab:An,versionId:n.versionId})}},r1=({promptVersion:n,language:a})=>{var i;const l=t1[a.toLocaleLowerCase()][(i=n.modelProvider)==null?void 0:i.toLocaleLowerCase()];if(!l||!("messages"in n.template))return null;const t={...n,template:{...n.template,messages:n.template.messages.map(r=>{try{return Wk({message:lc.parse(r),targetProvider:n.modelProvider})}catch(s){return console.warn("Cannot convert message"),console.error(s),null}}).filter(Boolean)}};return l(t)};function o1({promptVersion:n,language:a}){var i;const l=i1[a.toLocaleLowerCase()][(i=n.modelProvider)==null?void 0:i.toLocaleLowerCase()];if(!l)return null;const t={versionId:n.id};return l(t)}function tc({promptVersion:n}){const[a,l]=m.useState("Python"),t=x.useFragment(ec,n),i=m.useMemo(()=>r1({promptVersion:t,language:a}),[t,a]),r=m.useMemo(()=>o1({promptVersion:t,language:a}),[t,a]);return e(B,{title:"Code",variant:"compact",bodyStyle:{padding:0},extra:e(b,{gap:"size-100",alignItems:"center",children:e(Pl,{language:a,onChange:l,size:"S"})}),children:o(bn,{defaultExpandedKeys:["sdk-inline","client"],children:[o(fe,{id:"sdk-inline",children:[e(pe,{arrowPosition:"start",children:o(b,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:"size-100",width:"100%",children:[e(C,{children:"SDK Inline"}),i?e(de,{text:i}):null]})}),e(ye,{children:i==null?e(v,{width:"100%",padding:"size-200",children:e(C,{color:"text-300",children:"No code snippet available for this prompt"})}):e(_r,{language:a,value:i})})]}),o(fe,{id:"client",children:[e(pe,{arrowPosition:"start",children:o(b,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:"size-100",children:[e(C,{children:"Using the Client"}),r?e(de,{text:r}):null]})}),e(ye,{children:r==null?e(v,{width:"100%",padding:"size-200",children:e(C,{color:"text-300",children:"No client code snippet available for this prompt"})}):e(_r,{language:a,value:r})})]})]})})}function _r({language:n,value:a}){switch(n){case"Python":return e(Fo,{value:a,basicSetup:{lineNumbers:!0}});case"TypeScript":return e(_y,{value:a,basicSetup:{lineNumbers:!0}});default:Pe()}}const ic={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptLatestVersionsListFragment",selections:[{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:5}],concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptVersionSummaryFragment"}],storageKey:null}],storageKey:null}],storageKey:"promptVersions(first:5)"}],type:"Prompt",abstractKey:null};ic.hash="a473a6f0d927379542694312449a4c63";const rc=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptVersionSummaryFragment",selections:[n,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptVersionTagsList_data"}],type:"PromptVersion",abstractKey:null}}();rc.hash="80901eff49852a413f643ee876638174";const oc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptVersionTagsList_data",selections:[{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],type:"PromptVersion",abstractKey:null};oc.hash="25265fbc7ea915534615a56b4331236e";function sc({promptVersion:n}){const a=x.useFragment(oc,n);return e(b,{direction:"row",gap:"size-50",alignItems:"center",wrap:"wrap",children:a.tags.map(l=>e(s1,{children:l.name},l.id))})}function s1({children:n}){const a=m.useMemo(()=>{switch(n){case"production":return"var(--ac-global-color-green-1000)";case"staging":return"var(--ac-global-color-yellow-1000)";case"development":return"var(--ac-global-color-blue-1000)";default:return"var(--ac-global-color-grey-900)"}},[n]);return e(Cn,{color:a,children:n})}function dc(n){const a=x.useFragment(rc,n.promptVersion);return o(b,{direction:"column",gap:"size-50",children:[e(v,{width:"100%",children:e(b,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Cn,{color:"var(--ac-global-color-blue-900)",children:a.sequenceNumber}),e("span",{children:`${a.id}`})]})})}),e(v,{"data-testid":"prompt-version-item-description",paddingStart:"size-400",children:o(b,{direction:"column",gap:"size-100",children:[e(
|
|
1831
|
+
`.trim()),ra={python:{openai:{assignmentOperator:"=",removeKeyQuotes:!1,stringQuote:'"',sdkTemplate:Jk,clientTemplate:Xk},anthropic:{assignmentOperator:"=",removeKeyQuotes:!1,stringQuote:'"',sdkTemplate:e1,clientTemplate:a1}},typescript:{openai:{assignmentOperator:": ",removeKeyQuotes:!0,stringQuote:'"',sdkTemplate:Zk,clientTemplate:Yk},anthropic:{assignmentOperator:": ",removeKeyQuotes:!0,stringQuote:'"',sdkTemplate:n1,clientTemplate:l1}}},Ml=(n,a)=>{if(!("messages"in n.template))throw new Error("Prompt template does not contain messages");const l=[],{assignmentOperator:t,removeKeyQuotes:i,stringQuote:r}=a;if(n.modelName&&l.push(`model${t}${r}${n.modelName}${r}`),n.invocationParameters){const d=Object.entries(n.invocationParameters).map(([c,p])=>typeof p=="string"?`${c}${t}${r}${p}${r}`:gi(p)?`${c}${t}${El({json:p,level:1,removeKeyQuotes:i})}`:`${c}${t}${p}`);l.push(...d)}let s="";if(n.template.messages.length>0&&(s=El({json:n.template.messages,level:0,removeKeyQuotes:i}),l.push(t==="="?"messages=messages":"messages")),n.tools&&n.tools.length>0){const d=El({json:n.tools.map(c=>c.definition),level:1,removeKeyQuotes:i});l.push(`tools${t}${d}`)}if(n.responseFormat&&"definition"in n.responseFormat){const d=El({json:n.responseFormat.definition,level:1,removeKeyQuotes:i});l.push(`response_format${t}${d}`)}return{args:l,messages:s}},Lr=n=>"tool_calls"in n&&n.tool_calls?{...n,tool_calls:n.tool_calls.map(a=>({...a,function:{...a.function,arguments:JSON.stringify(a.function.arguments)}}))}:n,t1={python:{openai:n=>{const a=ra.python.openai,l={...n,template:{...n.template,messages:n.template.messages.map(r=>Lr(r))}},{args:t,messages:i}=Ml(l,a);return a.sdkTemplate({tab:An,args:t,messages:i})},anthropic:n=>{const a=ra.python.anthropic,{args:l,messages:t}=Ml(n,a);return a.sdkTemplate({tab:An,args:l,messages:t})}},typescript:{openai:n=>{const a=ra.typescript.openai,l={...n,template:{...n.template,messages:n.template.messages.map(r=>Lr(r))}},{args:t,messages:i}=Ml(l,a);return a.sdkTemplate({tab:An,args:t,messages:i})},anthropic:n=>{const a=ra.typescript.anthropic,{args:l,messages:t}=Ml(n,a);return a.sdkTemplate({tab:An,args:l,messages:t})}}},i1={python:{openai:n=>ra.python.openai.clientTemplate({tab:An,versionId:n.versionId}),anthropic:n=>ra.python.openai.clientTemplate({tab:An,versionId:n.versionId})},typescript:{openai:n=>ra.typescript.openai.clientTemplate({tab:An,versionId:n.versionId}),anthropic:n=>ra.typescript.anthropic.clientTemplate({tab:An,versionId:n.versionId})}},r1=({promptVersion:n,language:a})=>{var i;const l=t1[a.toLocaleLowerCase()][(i=n.modelProvider)==null?void 0:i.toLocaleLowerCase()];if(!l||!("messages"in n.template))return null;const t={...n,template:{...n.template,messages:n.template.messages.map(r=>{try{return Wk({message:lc.parse(r),targetProvider:n.modelProvider})}catch(s){return console.warn("Cannot convert message"),console.error(s),null}}).filter(Boolean)}};return l(t)};function o1({promptVersion:n,language:a}){var i;const l=i1[a.toLocaleLowerCase()][(i=n.modelProvider)==null?void 0:i.toLocaleLowerCase()];if(!l)return null;const t={versionId:n.id};return l(t)}function tc({promptVersion:n}){const[a,l]=m.useState("Python"),t=x.useFragment(ec,n),i=m.useMemo(()=>r1({promptVersion:t,language:a}),[t,a]),r=m.useMemo(()=>o1({promptVersion:t,language:a}),[t,a]);return e(B,{title:"Code",variant:"compact",bodyStyle:{padding:0},extra:e(b,{gap:"size-100",alignItems:"center",children:e(Pl,{language:a,onChange:l,size:"S"})}),children:o(bn,{defaultExpandedKeys:["sdk-inline","client"],children:[o(fe,{id:"sdk-inline",children:[e(pe,{arrowPosition:"start",children:o(b,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:"size-100",width:"100%",children:[e(C,{children:"SDK Inline"}),i?e(de,{text:i}):null]})}),e(ye,{children:i==null?e(v,{width:"100%",padding:"size-200",children:e(C,{color:"text-300",children:"No code snippet available for this prompt"})}):e(_r,{language:a,value:i})})]}),o(fe,{id:"client",children:[e(pe,{arrowPosition:"start",children:o(b,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",gap:"size-100",children:[e(C,{children:"Using the Client"}),r?e(de,{text:r}):null]})}),e(ye,{children:r==null?e(v,{width:"100%",padding:"size-200",children:e(C,{color:"text-300",children:"No client code snippet available for this prompt"})}):e(_r,{language:a,value:r})})]})]})})}function _r({language:n,value:a}){switch(n){case"Python":return e(Fo,{value:a,basicSetup:{lineNumbers:!0}});case"TypeScript":return e(_y,{value:a,basicSetup:{lineNumbers:!0}});default:Pe()}}const ic={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptLatestVersionsListFragment",selections:[{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:5}],concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptVersionSummaryFragment"}],storageKey:null}],storageKey:null}],storageKey:"promptVersions(first:5)"}],type:"Prompt",abstractKey:null};ic.hash="a473a6f0d927379542694312449a4c63";const rc=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptVersionSummaryFragment",selections:[n,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"PromptVersionTagsList_data"}],type:"PromptVersion",abstractKey:null}}();rc.hash="80901eff49852a413f643ee876638174";const oc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PromptVersionTagsList_data",selections:[{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],type:"PromptVersion",abstractKey:null};oc.hash="25265fbc7ea915534615a56b4331236e";function sc({promptVersion:n}){const a=x.useFragment(oc,n);return e(b,{direction:"row",gap:"size-50",alignItems:"center",wrap:"wrap",children:a.tags.map(l=>e(s1,{children:l.name},l.id))})}function s1({children:n}){const a=m.useMemo(()=>{switch(n){case"production":return"var(--ac-global-color-green-1000)";case"staging":return"var(--ac-global-color-yellow-1000)";case"development":return"var(--ac-global-color-blue-1000)";default:return"var(--ac-global-color-grey-900)"}},[n]);return e(Cn,{color:a,children:n})}function dc(n){const a=x.useFragment(rc,n.promptVersion);return o(b,{direction:"column",gap:"size-50",children:[e(v,{width:"100%",children:e(b,{direction:"row",justifyContent:"space-between",alignItems:"center",width:"100%",children:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Cn,{color:"var(--ac-global-color-blue-900)",children:a.sequenceNumber}),e("span",{children:`${a.id}`})]})})}),e(v,{"data-testid":"prompt-version-item-description",paddingStart:"size-400",children:o(b,{direction:"column",gap:"size-100",children:[e(dn,{maxWidth:"100%",children:e(C,{color:"text-700",size:"XS",children:a.description||"No Description"})}),o(b,{justifyContent:"space-between",alignItems:"center",gap:"size-100",children:[e(sc,{promptVersion:a}),o(b,{direction:"row",gap:"size-100",alignItems:"center",flex:"none",children:[a.user&&o(b,{direction:"row",gap:"size-50",alignItems:"center",children:[e(nt,{size:14,name:a.user.username,profilePictureUrl:a.user.profilePictureUrl}),e(C,{size:"XS",children:a.user.username})]}),e(C,{color:"text-300",size:"XS",children:gp(a.createdAt,Date.now())})]})]})]})})]})}const d1=5,c1=F`
|
|
1832
1832
|
padding-bottom: var(--ac-global-dimension-size-200);
|
|
1833
1833
|
position: relative;
|
|
1834
1834
|
`;function u1(n){const{prompt:a}=n,l=x.useFragment(ic,a),t=m.useMemo(()=>{var i,r;return(r=(i=l==null?void 0:l.latestVersions)==null?void 0:i.edges)==null?void 0:r.map(s=>s.version)},[l]);if(!t)throw new Error("Expected prompt versions to be defined");return o("div",{children:[e("ul",{children:t.map((i,r)=>{const s=r===d1-1;return o("li",{css:c1,children:[e(dc,{promptVersion:i}),i.sequenceNumber!=1?e(g1,{isLastConnector:s}):null]},i.id)})}),e(b,{direction:"row",justifyContent:"end",children:e(we,{to:"versions",children:"View all versions"})})]})}const m1=F`
|
|
@@ -1862,7 +1862,7 @@ console.log(response.content);
|
|
|
1862
1862
|
id
|
|
1863
1863
|
}
|
|
1864
1864
|
}
|
|
1865
|
-
`}}}();uc.hash="081b8cf05c35b46579fe5cbb85f7a761";const f1=({promptId:n,promptName:a,promptDescription:l,setDialog:t})=>{var h;const i=me(),r=ce(),[s,d]=x.useMutation(uc),c=Ve({disabled:d,reValidateMode:"onBlur",mode:"onChange",defaultValues:{name:`${a}-clone`,description:l}}),{control:p,handleSubmit:y,formState:{isValid:u,errors:g},setError:f}=c,k=y(S=>{s({variables:{input:{promptId:n,name:S.name,description:S.description}},onCompleted:K=>{t(null),i({title:"Prompt cloned successfully",action:{text:"View Prompt",onClick:()=>{r(`/prompts/${K.clonePrompt.id}`)}}})},onError:K=>{var I;const P=
|
|
1865
|
+
`}}}();uc.hash="081b8cf05c35b46579fe5cbb85f7a761";const f1=({promptId:n,promptName:a,promptDescription:l,setDialog:t})=>{var h;const i=me(),r=ce(),[s,d]=x.useMutation(uc),c=Ve({disabled:d,reValidateMode:"onBlur",mode:"onChange",defaultValues:{name:`${a}-clone`,description:l}}),{control:p,handleSubmit:y,formState:{isValid:u,errors:g},setError:f}=c,k=y(S=>{s({variables:{input:{promptId:n,name:S.name,description:S.description}},onCompleted:K=>{t(null),i({title:"Prompt cloned successfully",action:{text:"View Prompt",onClick:()=>{r(`/prompts/${K.clonePrompt.id}`)}}})},onError:K=>{var I;const P=Ie(K);(I=P==null?void 0:P[0])!=null&&I.includes("already exists")?f("name",{message:P==null?void 0:P[0]}):f("root",{message:P==null?void 0:P[0]})}})});return e(te,{title:"Clone Prompt",children:e(m.Suspense,{fallback:e(ge,{}),children:e(v,{padding:"size-200",children:o("form",{onSubmit:k,children:[e(H,{control:p,name:"name",rules:{required:{message:"Name is required",value:!0},validate:{unique:S=>S.trim()===a.trim()?"Name must be different from the original prompt name":!0}},render:({field:{onChange:S,onBlur:K,value:P,disabled:I},fieldState:{error:D}})=>o(X,{isInvalid:!!(D!=null&&D.message),children:[e(G,{children:"Name"}),e(Z,{name:"name",type:"text",onChange:S,onBlur:K,value:P,disabled:I}),!D&&e(C,{slot:"description",children:"A name for the cloned prompt."}),e(Se,{children:D==null?void 0:D.message})]})}),e(H,{control:p,name:"description",render:({field:{onChange:S,onBlur:K,value:P,disabled:I},fieldState:{error:D}})=>o(X,{isInvalid:!!(D!=null&&D.message),isDisabled:I,value:P,onChange:S,onBlur:K,children:[e(G,{children:"Description"}),e(fa,{name:"description"}),!D&&e(C,{slot:"description",children:"A description for the cloned prompt."}),e(Se,{children:D==null?void 0:D.message})]})}),(g==null?void 0:g.root)&&e(C,{color:"danger",children:(h=g==null?void 0:g.root)==null?void 0:h.message}),o(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",onPress:()=>t(null),isDisabled:d,children:"Cancel"}),e(E,{type:"submit",variant:"primary",isDisabled:!u,isPending:d,children:"Clone"})]})]})})})})},h1=F`
|
|
1866
1866
|
flex: 1 1 auto;
|
|
1867
1867
|
display: flex;
|
|
1868
1868
|
flex-direction: column;
|
|
@@ -2072,7 +2072,7 @@ fragment ExampleExperimentRunsTableFragment on DatasetExample {
|
|
|
2072
2072
|
}
|
|
2073
2073
|
id
|
|
2074
2074
|
}
|
|
2075
|
-
`}}}();fc.hash="6d46e4ae967aef17925132308b2b0573";const
|
|
2075
|
+
`}}}();fc.hash="6d46e4ae967aef17925132308b2b0573";const un="selectedSpanNodeId",hc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"DatasetMutationPayload",kind:"LinkedField",name:"patchDatasetExamples",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"EditExampleDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"EditExampleDialogMutation",selections:a},params:{cacheID:"7217082d3d3796ecb60481d17133c351",id:null,metadata:{},name:"EditExampleDialogMutation",operationKind:"mutation",text:`mutation EditExampleDialogMutation(
|
|
2076
2076
|
$input: PatchDatasetExamplesInput!
|
|
2077
2077
|
) {
|
|
2078
2078
|
patchDatasetExamples(input: $input) {
|
|
@@ -2160,16 +2160,16 @@ fragment ExampleExperimentRunsTableFragment_2HEEH6 on DatasetExample {
|
|
|
2160
2160
|
`;function E1({example:n}){const a=m.useRef(null),l=ce(),{data:t,loadNext:i,hasNext:r,isLoadingNext:s}=x.usePaginationFragment(bc,n),d=m.useMemo(()=>t.experimentRuns.edges.map(f=>{let k=null;return f.run.startTime&&f.run.endTime&&(k=new Date(f.run.endTime).getTime()-new Date(f.run.startTime).getTime()),{...f.run,output:JSON.stringify(f.run.output),latencyMs:k}}),[t]),p=Ke({columns:[{header:"start time",accessorKey:"startTime",cell:_e},{header:"output",accessorKey:"output",cell:f=>{var h;const k=(h=f.row.original)==null?void 0:h.error;return k!==null?e(C,{color:"danger",children:k}):e(Ee,{...f})}},{header:"latency",accessorKey:"latencyMs",cell:({getValue:f})=>{const k=f();return k===null||typeof k!="number"?"--":e($e,{latencyMs:k})}},{header:"evaluations",accessorKey:"annotations",cell:({row:f})=>e(b,{direction:"row",gap:"size-50",wrap:"wrap",children:f.original.annotations.edges.map((k,h)=>{const S=k.annotation;return e(To,{annotation:S,extra:S.trace&&e(v,{paddingTop:"size-100",children:o("div",{css:R1,children:[e(_,{svg:e(qn,{})}),e("span",{children:"Click to view evaluator trace"})]})}),children:e(Ua,{annotation:S,onClick:()=>{S.trace&&l(`/projects/${S.trace.projectId}/traces/${S.trace.traceId}`)}},h)},h)})})},{id:"actions",cell:({row:f})=>{const k=f.original.trace;if(k)return e(E,{size:"S",leadingVisual:e(_,{svg:e(rt,{})}),onPress:()=>{l(`/projects/${k.projectId}/traces/${k.traceId}`)},"aria-label":"view trace"})}}],data:d,getCoreRowModel:Te()}),y=p.getRowModel().rows,u=y.length===0,g=m.useCallback(f=>{if(f){const{scrollHeight:k,scrollTop:h,clientHeight:S}=f;k-h-S<300&&!s&&r&&i(A1)}},[r,s,i]);return e("div",{css:F`
|
|
2161
2161
|
flex: 1 1 auto;
|
|
2162
2162
|
overflow: auto;
|
|
2163
|
-
`,ref:a,onScroll:f=>g(f.target),children:o("table",{css:$n,children:[e("thead",{children:p.getHeaderGroups().map(f=>e("tr",{children:f.headers.map(k=>e("th",{children:e("div",{children:W(k.column.columnDef.header,k.getContext())})},k.id))},f.id))}),u?e(w1,{}):e("tbody",{children:y.map(f=>e("tr",{children:f.getVisibleCells().map(k=>e("td",{children:W(k.column.columnDef.cell,k.getContext())},k.id))},f.id))})]})})}function Bi({exampleId:n,onDismiss:a}){const[l,t]=m.useState(0),i=x.useLazyLoadQuery(fc,{exampleId:n},{fetchKey:l,fetchPolicy:"store-and-network"}),r=m.useMemo(()=>{const u=i.example.latestRevision;return{input:JSON.stringify(u==null?void 0:u.input,null,2),output:JSON.stringify(u==null?void 0:u.output,null,2),metadata:JSON.stringify(u==null?void 0:u.metadata,null,2)}},[i]),s=m.useMemo(()=>{const u=i.example.span;return u?{id:u.id,traceId:u.trace.traceId,projectId:u.trace.project.id}:null},[i]),{input:d,output:c,metadata:p}=r,y=me();return e(re,{type:"slideOver",isDismissable:!0,onDismiss:a,children:e(te,{size:"XL",title:`Example: ${n}`,extra:o(b,{direction:"row",gap:"size-100",children:[s?e(Wn,{size:"S",to:`/projects/${s.projectId}/traces/${s.traceId}?${
|
|
2163
|
+
`,ref:a,onScroll:f=>g(f.target),children:o("table",{css:$n,children:[e("thead",{children:p.getHeaderGroups().map(f=>e("tr",{children:f.headers.map(k=>e("th",{children:e("div",{children:W(k.column.columnDef.header,k.getContext())})},k.id))},f.id))}),u?e(w1,{}):e("tbody",{children:y.map(f=>e("tr",{children:f.getVisibleCells().map(k=>e("td",{children:W(k.column.columnDef.cell,k.getContext())},k.id))},f.id))})]})})}function Bi({exampleId:n,onDismiss:a}){const[l,t]=m.useState(0),i=x.useLazyLoadQuery(fc,{exampleId:n},{fetchKey:l,fetchPolicy:"store-and-network"}),r=m.useMemo(()=>{const u=i.example.latestRevision;return{input:JSON.stringify(u==null?void 0:u.input,null,2),output:JSON.stringify(u==null?void 0:u.output,null,2),metadata:JSON.stringify(u==null?void 0:u.metadata,null,2)}},[i]),s=m.useMemo(()=>{const u=i.example.span;return u?{id:u.id,traceId:u.trace.traceId,projectId:u.trace.project.id}:null},[i]),{input:d,output:c,metadata:p}=r,y=me();return e(re,{type:"slideOver",isDismissable:!0,onDismiss:a,children:e(te,{size:"XL",title:`Example: ${n}`,extra:o(b,{direction:"row",gap:"size-100",children:[s?e(Wn,{size:"S",to:`/projects/${s.projectId}/traces/${s.traceId}?${un}=${s.id}`,children:"View Source Span"}):null,e(_1,{exampleId:n,currentRevision:r,onCompleted:()=>{y({title:"Example updated",message:`Example ${n} has been updated.`}),t(u=>u+1)}})]}),children:o(Pn,{direction:"vertical",autoSaveId:"example-panel-group",children:[e(Re,{defaultSize:65,children:e("div",{css:F`
|
|
2164
2164
|
overflow-y: auto;
|
|
2165
2165
|
height: 100%;
|
|
2166
|
-
`,children:e(b,{direction:"row",justifyContent:"center",children:e(v,{width:"900px",paddingStart:"auto",paddingEnd:"auto",paddingTop:"size-200",paddingBottom:"size-200",children:o(b,{direction:"column",gap:"size-200",children:[e(B,{title:"Input",...Vt,extra:e(de,{text:d}),children:e(
|
|
2166
|
+
`,children:e(b,{direction:"row",justifyContent:"center",children:e(v,{width:"900px",paddingStart:"auto",paddingEnd:"auto",paddingTop:"size-200",paddingBottom:"size-200",children:o(b,{direction:"column",gap:"size-200",children:[e(B,{title:"Input",...Vt,extra:e(de,{text:d}),children:e(hn,{value:d})}),e(B,{title:"Output",...Vt,extra:e(de,{text:c}),children:e(hn,{value:c})}),e(B,{title:"Metadata",...Vt,extra:e(de,{text:p}),children:e(hn,{value:p})})]})})})})}),e(Rn,{css:Ha}),e(Re,{defaultSize:35,children:o(b,{direction:"column",height:"100%",children:[e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:e(ae,{level:3,children:"Experiment Runs"})}),e(E1,{example:i.example})]})})]})})})}const Vt={backgroundColor:"light",borderColor:"light",variant:"compact",collapsible:!0,bodyStyle:{padding:0}};function M1(){const[n,a]=mn(),l=n.get("exampleId"),t=n.get("datasetId");return!l||!t?null:e(Bi,{exampleId:l,onDismiss:()=>{a(i=>(i.delete("exampleId"),i))}})}const V1=`
|
|
2167
2167
|
The playground is not available until an LLM provider client is installed on the server.
|
|
2168
2168
|
`,z1=n=>`
|
|
2169
2169
|
# Installing one or more of the clients will enable the playground
|
|
2170
2170
|
${Array.from(n.reduce((a,l)=>(l.dependencies.forEach(t=>a.add(t)),a),new Set)).map(a=>`pip install ${a}`).join(`
|
|
2171
2171
|
`)}
|
|
2172
|
-
`,N1=n=>e(v,{height:"100%",width:"100%",children:o(b,{direction:"column",alignItems:"center",justifyContent:"center",gap:"size-200",children:[e(Po,{message:V1,graphicKey:"not found",size:"L"}),e(C,{children:"The following clients are supported:"}),e(Fo,{value:z1(n.availableProviders)})]})}),$1={OPENAI:"OPENAI_API_KEY",ANTHROPIC:"ANTHROPIC_API_KEY",AZURE_OPENAI:"AZURE_OPENAI_API_KEY",GOOGLE:"GEMINI_API_KEY"};function j1(){const n=O(s=>Array.from(new Set(s.instances.map(d=>d.model.provider)))),a=O(s=>s.instances.some(d=>d.activeRunId!=null)),l=Qa(s=>s.setCredential),t=Qa(s=>s),[i,r]=m.useState(!1);return e("div",{css:F`
|
|
2172
|
+
`,N1=n=>e(v,{height:"100%",width:"100%",children:o(b,{direction:"column",alignItems:"center",justifyContent:"center",gap:"size-200",children:[e(Po,{message:V1,graphicKey:"not found",size:"L"}),e(C,{children:"The following clients are supported:"}),e(Fo,{value:z1(n.availableProviders)})]})}),$1={OPENAI:"OPENAI_API_KEY",ANTHROPIC:"ANTHROPIC_API_KEY",AZURE_OPENAI:"AZURE_OPENAI_API_KEY",GOOGLE:"GEMINI_API_KEY",DEEPSEEK:"DEEPSEEK_API_KEY"};function j1(){const n=O(s=>Array.from(new Set(s.instances.map(d=>d.model.provider)))),a=O(s=>s.instances.some(d=>d.activeRunId!=null)),l=Qa(s=>s.setCredential),t=Qa(s=>s),[i,r]=m.useState(!1);return e("div",{css:F`
|
|
2173
2173
|
.ac-dropdown-button {
|
|
2174
2174
|
min-width: 0px;
|
|
2175
2175
|
}
|
|
@@ -2372,11 +2372,11 @@ fragment PlaygroundDatasetExamplesTableFragment on Dataset {
|
|
|
2372
2372
|
id
|
|
2373
2373
|
}
|
|
2374
2374
|
}
|
|
2375
|
-
`}}}();xc.hash="e2203e071e6fce91c764fa6fee48dfc1";function B1({runId:n}){var d,c,p;const l=x.useLazyLoadQuery(xc,{runId:n}).run,t=(d=l.example)==null?void 0:d.id,i=(c=l.example)==null?void 0:c.revision,r=i==null?void 0:i.input,s=i==null?void 0:i.output;return e(te,{title:`Experiment Run for Example: ${t}`,size:"fullscreen",children:o(Pn,{direction:"vertical",autoSaveId:"example-compare-panel-group",children:[e(Re,{defaultSize:33,children:e(v,{overflow:"auto",height:"100%",padding:"size-200",children:o(b,{direction:"row",gap:"size-200",flex:"1 1 auto",children:[e(v,{width:"50%",children:e(B,{title:"Input",...Ar,bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},extra:e(de,{text:JSON.stringify(r)}),children:e(
|
|
2375
|
+
`}}}();xc.hash="e2203e071e6fce91c764fa6fee48dfc1";function B1({runId:n}){var d,c,p;const l=x.useLazyLoadQuery(xc,{runId:n}).run,t=(d=l.example)==null?void 0:d.id,i=(c=l.example)==null?void 0:c.revision,r=i==null?void 0:i.input,s=i==null?void 0:i.output;return e(te,{title:`Experiment Run for Example: ${t}`,size:"fullscreen",children:o(Pn,{direction:"vertical",autoSaveId:"example-compare-panel-group",children:[e(Re,{defaultSize:33,children:e(v,{overflow:"auto",height:"100%",padding:"size-200",children:o(b,{direction:"row",gap:"size-200",flex:"1 1 auto",children:[e(v,{width:"50%",children:e(B,{title:"Input",...Ar,bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},extra:e(de,{text:JSON.stringify(r)}),children:e(hn,{value:JSON.stringify(r,null,2)})})}),e(v,{width:"50%",children:e(B,{title:"Reference Output",...Ar,extra:e(de,{text:JSON.stringify(s)}),bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},children:e(hn,{value:JSON.stringify(s,null,2)})})})]})})}),e(Rn,{css:Ha}),e(Re,{defaultSize:67,children:o(b,{direction:"column",height:"100%",children:[e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:e(ae,{level:2,children:"Experiment Run Output"})}),e("div",{css:F`
|
|
2376
2376
|
overflow-y: auto;
|
|
2377
2377
|
height: 100%;
|
|
2378
2378
|
padding: var(--ac-global-dimension-static-size-200);
|
|
2379
|
-
`,children:o(b,{direction:"row",children:[e(v,{flex:!0,children:l.error?e(v,{padding:"size-200",children:e(U1,{error:l.error})}):e(
|
|
2379
|
+
`,children:o(b,{direction:"row",children:[e(v,{flex:!0,children:l.error?e(v,{padding:"size-200",children:e(U1,{error:l.error})}):e(hn,{value:JSON.stringify(l.output,null,2)})}),o(xa,{width:"size-3000",children:[l.startTime&&l.endTime&&e(q1,{startTime:l.startTime,endTime:l.endTime}),e("ul",{css:F`
|
|
2380
2380
|
margin-top: var(--ac-global-dimension-static-size-100);
|
|
2381
2381
|
display: flex;
|
|
2382
2382
|
flex-direction: column;
|
|
@@ -2677,7 +2677,7 @@ fragment SpanHeader_span on Span {
|
|
|
2677
2677
|
fragment TraceHeaderRootSpanAnnotationsFragment on Span {
|
|
2678
2678
|
...AnnotationSummaryGroup
|
|
2679
2679
|
}
|
|
2680
|
-
`}}}();Dc.hash="e2fbe3f1daee23ca2ad099cc7c5f0d90";function H1(n,a){const l=m.useRef(null);m.useEffect(()=>{l.current=n},[n]),m.useEffect(()=>{function t(){l.current&&l.current()}{const i=setInterval(t,a);return()=>clearInterval(i)}},[a])}function G1(){const{locale:n}=fp();return m.useMemo(()=>My(n),[n])}const W1=n=>{const[a,l]=m.useState(null);return m.useEffect(()=>{if(!n.current)return;const t=new ResizeObserver(i=>{if(!i||i.length===0)return;const{width:r,height:s}=i[0].contentRect;l({width:r,height:s})});return t.observe(n.current),()=>{t.disconnect()}},[n]),a};function wr(n){return Array.isArray(n)&&n.every(a=>typeof a=="object"&&ve.message in a&&J1(a[ve.message]))}function J1(n){return typeof n=="object"&&n!==null&&ze.role in n}function Lc(n){return n==="OPENAI"||n==="AZURE_OPENAI"||n==="ANTHROPIC"||n==="GOOGLE"}const zt=F`
|
|
2680
|
+
`}}}();Dc.hash="e2fbe3f1daee23ca2ad099cc7c5f0d90";function H1(n,a){const l=m.useRef(null);m.useEffect(()=>{l.current=n},[n]),m.useEffect(()=>{function t(){l.current&&l.current()}{const i=setInterval(t,a);return()=>clearInterval(i)}},[a])}function G1(){const{locale:n}=fp();return m.useMemo(()=>My(n),[n])}const W1=n=>{const[a,l]=m.useState(null);return m.useEffect(()=>{if(!n.current)return;const t=new ResizeObserver(i=>{if(!i||i.length===0)return;const{width:r,height:s}=i[0].contentRect;l({width:r,height:s})});return t.observe(n.current),()=>{t.disconnect()}},[n]),a};function wr(n){return Array.isArray(n)&&n.every(a=>typeof a=="object"&&ve.message in a&&J1(a[ve.message]))}function J1(n){return typeof n=="object"&&n!==null&&ze.role in n}function Lc(n){return n==="OPENAI"||n==="AZURE_OPENAI"||n==="ANTHROPIC"||n==="GOOGLE"||n==="DEEPSEEK"}const zt=F`
|
|
2681
2681
|
display: flex;
|
|
2682
2682
|
align-items: center;
|
|
2683
2683
|
.ac-text {
|
|
@@ -2687,9 +2687,9 @@ fragment TraceHeaderRootSpanAnnotationsFragment on Span {
|
|
|
2687
2687
|
overflow: hidden;
|
|
2688
2688
|
text-overflow: ellipsis;
|
|
2689
2689
|
}
|
|
2690
|
-
`;function
|
|
2690
|
+
`;function kn(n){const{name:a,metric:l,k:t,score:i}=n,r=typeof t=="number"?`${l}@${t}`:l,s=m.useMemo(()=>l==="hit"?i?"true":"false":typeof i=="number"&&za(i)||"--",[i,l]);return o(Le,{delay:500,offset:3,children:[e(Ne,{children:e("div",{css:Vy,children:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(zy,{color:"var(--ac-global-color-seafoam-1000)"}),a?e("div",{css:zt,children:e(C,{weight:"heavy",size:"XS",color:"inherit",children:a})}):null,e("div",{css:zt,children:e(C,{size:"XS",color:"inherit",children:r})}),e("div",{css:zt,children:e(C,{size:"XS",children:s})})]})})}),e(Hn,{children:o(b,{direction:"row",gap:"size-100",children:[o(C,{weight:"heavy",color:"inherit",children:[a," ",r]}),e(C,{color:"inherit",children:s})]})})]})}const _c={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SpanHeader_span",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},{alias:"code",args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null}],type:"Span",abstractKey:null};_c.hash="521c85902b5ffee719617ed60be1a3b4";function Z1(n){const a=x.useFragment(_c,n.span),l=m.useMemo(()=>new Date(a.startTime),[a.startTime]);return e(b,{direction:"row",gap:"size-100",width:"100%",height:"100%",alignItems:"center",children:o(b,{direction:"column",gap:"size-50",children:[o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(vi,{spanKind:a.spanKind}),e(C,{size:"L",children:a.name}),e(ot,{statusCode:a.code,css:F`
|
|
2691
2691
|
font-size: var(--ac-global-font-size-m);
|
|
2692
|
-
`})]}),o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[typeof a.latencyMs=="number"?e($e,{latencyMs:a.latencyMs,size:"S"}):null,o(C,{color:"text-500",size:"S",children:["at ",Jn(l)]}),a.tokenCountTotal?e(va,{tokenCountTotal:a.tokenCountTotal,nodeId:a.id,size:"S"}):null]})]})})}function X1(n){const{spanId:a,traceId:l}=n,t=me();return o(
|
|
2692
|
+
`})]}),o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[typeof a.latencyMs=="number"?e($e,{latencyMs:a.latencyMs,size:"S"}):null,o(C,{color:"text-500",size:"S",children:["at ",Jn(l)]}),a.tokenCountTotal?e(va,{tokenCountTotal:a.tokenCountTotal,nodeId:a.id,size:"S"}):null]})]})})}function X1(n){const{spanId:a,traceId:l}=n,t=me();return o(Ue,{children:[e(E,{size:"S",leadingVisual:e(_,{svg:e(xo,{})})}),e(Oa,{children:e(pn,{children:({close:i})=>o(Io,{style:{minHeight:"auto"},onAction:r=>{switch(r){case"COPY_SPAN_ID":{tr(a),t({title:"Span ID Copied",message:`The Span ID ${a} has been copied to your clipboard`});break}case"COPY_TRACE_ID":{tr(l),t({title:"Trace ID Copied",message:`The Trace ID ${l} has been copied to your clipboard`});break}default:Pe()}i()},children:[e(lr,{id:"COPY_SPAN_ID",children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(Wt,{})}),e(C,{children:"Copy Span ID"})]})}),e(lr,{id:"COPY_TRACE_ID",children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(Wt,{})}),e(C,{children:"Copy Trace ID"})]})})]})})})]})}const Ac=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a=[n];return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SpanAsideAnnotationList_span",selections:[{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[n,{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:"configs",args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"config",args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:a,type:"Node",abstractKey:"__isNode"},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:a,storageKey:null},{args:null,kind:"FragmentSpread",name:"AnnotationSummaryGroup"}],type:"Span",abstractKey:null}}();Ac.hash="8db090103425204eda8bf8e16580f622";const wc=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SpanAside_span",selections:[n,{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[n,{args:null,kind:"FragmentSpread",name:"AnnotationConfigListProjectAnnotationConfigFragment"},{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:"configs",args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"config",args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[n],type:"Node",abstractKey:"__isNode"},{kind:"InlineFragment",selections:[a,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null}],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null}],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"lowerBound",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"upperBound",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null}],type:"ContinuousAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[a],type:"FreeformAnnotationConfig",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:"code",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:"endTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{args:null,kind:"FragmentSpread",name:"TraceHeaderRootSpanAnnotationsFragment"},{args:null,kind:"FragmentSpread",name:"SpanAsideAnnotationList_span"},{args:null,kind:"FragmentSpread",name:"AnnotationSummaryGroup"}],type:"Span",abstractKey:null}}();wc.hash="eddd0b1c2288899c1d97948a29207944";const Rc=m.createContext(null);function xt(){const n=m.useContext(Rc);if(n===null)throw new Error("useSpanFilterCondition must be used within a SpanFilterConditionProvider");return n}function Ui(n){const[a,l]=m.useState(""),t=m.useCallback(r=>{m.startTransition(()=>{l(r)})},[]),i=m.useCallback(r=>{m.startTransition(()=>{a.length>0?l(a+" and "+r):l(r)})},[a]);return e(Rc.Provider,{value:{filterCondition:a,setFilterCondition:t,appendFilterCondition:i},children:n.children})}function gT(n){const{appendFilterCondition:a}=xt(),{annotation:l,className:t}=n,{name:i,label:r,score:s}=l,d=m.useMemo(()=>{const c=[];return typeof s=="number"?(c.push({filterName:"greater than",filterCondition:`annotations['${i}'].score > ${s}`}),c.push({filterName:"less than",filterCondition:`annotations['${i}'].score < ${s}`}),c.push({filterName:"equals",filterCondition:`annotations['${i}'].score == ${s}`})):r!=null&&(c.push({filterName:"match",filterCondition:`annotations['${i}'].label == "${r}"`}),c.push({filterName:"exclude",filterCondition:`annotations['${i}'].label != "${r}"`})),c},[i,r,s]);return d.length===0?null:e("ul",{className:t,css:F`
|
|
2693
2693
|
display: flex;
|
|
2694
2694
|
height: 100%;
|
|
2695
2695
|
flex-direction: row;
|
|
@@ -2792,7 +2792,7 @@ fragment AnnotationSummaryValueFragment_4BTVrq on Project {
|
|
|
2792
2792
|
}
|
|
2793
2793
|
id
|
|
2794
2794
|
}
|
|
2795
|
-
`}}}();Vc.hash="3853ce97f7a810755cb61812e309942d";const zc=m.createContext(null);function Ra(){const n=m.useContext(zc);if(n===null)throw new Error("useStreamState must be used within a StreamStateProvider");return n}function Y1({initialFetchKey:n="initial",children:a}){const l=
|
|
2795
|
+
`}}}();Vc.hash="3853ce97f7a810755cb61812e309942d";const zc=m.createContext(null);function Ra(){const n=m.useContext(zc);if(n===null)throw new Error("useStreamState must be used within a StreamStateProvider");return n}function Y1({initialFetchKey:n="initial",children:a}){const l=cn(d=>d.traceStreamingEnabled),t=cn(d=>d.setTraceStreamingEnabled),[i,r]=m.useState(n),s=m.useCallback(d=>{m.startTransition(()=>{r(d)})},[r]);return e(zc.Provider,{value:{isStreaming:l,setIsStreaming:t,fetchKey:i,setFetchKey:s},children:a})}function eb({annotationName:n}){var i,r;const{projectId:a}=Oe(),{timeRange:l}=ct(),t=x.useLazyLoadQuery(Vc,{annotationName:n,id:a,timeRange:{start:(i=l==null?void 0:l.start)==null?void 0:i.toISOString(),end:(r=l==null?void 0:l.end)==null?void 0:r.toISOString()}});return e(ab,{name:n,children:e(nb,{annotationName:n,project:t.project})})}function nb(n){var s,d,c,p;const{project:a,annotationName:l}=n,{fetchKey:t}=Ra(),[i,r]=x.useRefetchableFragment(Mc,a);return m.useEffect(()=>{m.startTransition(()=>{r({},{fetchPolicy:"store-and-network"})})},[t,r]),e(lb,{name:l,meanScore:(s=i==null?void 0:i.spanAnnotationSummary)==null?void 0:s.meanScore,labelFractions:(d=i==null?void 0:i.spanAnnotationSummary)==null?void 0:d.labelFractions,annotationConfig:(p=(c=i==null?void 0:i.annotationConfigs)==null?void 0:c.edges.find(y=>y.node.name===l))==null?void 0:p.node})}function ab({children:n,name:a}){return o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:e(dn,{maxWidth:"120px",children:a})}),e(m.Suspense,{fallback:e(C,{size:"L",children:"--"}),children:n})]})}const Rr={M:{chart:{width:24,height:24},pie:{innerRadius:8,outerRadius:11}},S:{chart:{width:16,height:16},pie:{innerRadius:6,outerRadius:8}},L:{chart:{width:32,height:32},pie:{innerRadius:10,outerRadius:13}}};function Nc(n,a,l,t){if(!t||t.annotationType!=="CATEGORICAL"||!t.values)return n[a%n.length];const r=[...t.values].sort((s,d)=>{const c=s.score??0,p=d.score??0;return(t.optimizationDirection==="MAXIMIZE"?-1:1)*(c-p)}).map(s=>s.label).indexOf(l);return n[r%n.length]}function $c(n){const a=Zn();return[Lo(n),a.default,a.gray600,a.gray400,a.gray200]}function lb({name:n,meanScore:a,labelFractions:l,size:t="M",disableAnimation:i=!1,meanScoreFallback:r,annotationConfig:s}){const d=typeof a=="number",c=Array.isArray(l)&&l.length>0;return!d&&!c?e(C,{size:"L",children:"--"}):o(Le,{delay:0,placement:"bottom",children:[e(Ne,{children:e(tb,{name:n,meanScore:a,labelFractions:l,size:t,disableAnimation:i,meanScoreFallback:r,annotationConfig:s})}),e(Hn,{children:e(jc,{annotationName:n,labelFractions:l,meanScore:a,annotationConfig:s})})]})}function tb({name:n,meanScore:a,labelFractions:l,size:t="M",disableAnimation:i,meanScoreFallback:r,annotationConfig:s}){const d=$c(n),c=typeof a=="number",p=l&&l.length>0;if(!c&&!p)return e(C,{size:"L",children:"--"});const y=Rr[t].chart,u=Rr[t].pie;return o(b,{direction:"row",alignItems:"center",justifyContent:"space-between",gap:"size-100",children:[p?e(ds,{...y,children:e(os,{data:l,dataKey:"fraction",nameKey:"label",cx:"50%",cy:"50%",...u,strokeWidth:0,stroke:"transparent",animationDuration:i?0:void 0,children:l.map((g,f)=>e(ss,{fill:Nc(d,f,g.label,s)},`cell-${f}`))})}):null,e(st,{fallback:r,value:a,size:t==="S"?t:"L"})]})}function jc({annotationName:n,labelFractions:a,meanScore:l,annotationConfig:t}){const i=$c(n),r=typeof l=="number"&&!isNaN(l),s=a&&a.length>0;return e(v,{width:"size-2400",children:o(b,{direction:"column",gap:"size-50",children:[s&&e("ul",{children:a.map((d,c)=>e("li",{children:e(qe,{color:Nc(i,c,d.label,t),name:d.label,shape:"square",value:Do(d.fraction*100)})},d.label))}),s&&r?e(dt,{}):null,r?o(b,{direction:"row",justifyContent:"space-between",children:[e(C,{children:"mean score"}),e(st,{value:l})]}):null]})})}function Oc({name:n,labelFractions:a,annotationConfig:l}){var d;const t=a.reduce((c,p)=>Math.max(c,p.fraction),0),i=(d=a.find(c=>c.fraction===t))==null?void 0:d.label,r=a.length-1,s=r>0;return i?o(Le,{delay:0,placement:"bottom",children:[e(Ne,{children:o(b,{direction:"row",alignItems:"center",gap:"size-50",maxWidth:s?"80%":"99%",children:[e(Cn,{style:{maxWidth:"100%"},children:e(dn,{maxWidth:"100%",children:i})}),s&&o(Cn,{children:["+ ",r]})]})}),e(Hn,{children:e(jc,{annotationName:n,labelFractions:a,annotationConfig:l})})]}):null}const pT=n=>Object.values(n.reduce((a,l)=>(a[l.name]?new Date(a[l.name].createdAt)<new Date(l.createdAt)&&(a[l.name]=l):a[l.name]=l,a),{})),Qc=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"annotationInput",variableName:"input"}],concreteType:"SpanAnnotationMutationPayload",kind:"LinkedField",name:"createSpanNote",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanNotesEditorAddNoteMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanNotesEditorAddNoteMutation",selections:a},params:{cacheID:"855aa00f68b36e86f375e7765413ac81",id:null,metadata:{},name:"SpanNotesEditorAddNoteMutation",operationKind:"mutation",text:`mutation SpanNotesEditorAddNoteMutation(
|
|
2796
2796
|
$input: CreateSpanNoteInput!
|
|
2797
2797
|
) {
|
|
2798
2798
|
createSpanNote(annotationInput: $input) {
|
|
@@ -2865,7 +2865,7 @@ fragment SpanFeedback_annotations on Span {
|
|
|
2865
2865
|
margin: 0 0 var(--ac-global-dimension-size-100) 0;
|
|
2866
2866
|
`,children:"Annotations are pivotal for tracking and improving the performance of your application. Phoenix allows for both LLM and HUMAN annotations."}),e(Sn,{href:"https://docs.arize.com/phoenix/tracing/concepts-tracing/how-to-evaluate-traces",children:"View annotation documentation"})]})}))},leadingVisual:e(_,{svg:e(bi,{})}),children:"How to Annotate"})]}),e(re,{onDismiss:()=>a(null),isDismissable:!0,children:n})]})}const ub=F`
|
|
2867
2867
|
overflow: auto;
|
|
2868
|
-
`;function mb({annotations:n,spanNodeId:a}){const l=m.useMemo(()=>n.map(u=>({...u,spanNodeId:a})),[n,a]),t=me(),i=ke(),r=m.useMemo(()=>[{header:"name",accessorKey:"name",size:100},{header:"annotator kind",accessorKey:"annotatorKind",size:100,cell:({row:u})=>{const g=u.original.annotatorKind;return e(Oy,{kind:g})}},{header:"user",accessorKey:"user",size:100,cell:({row:u})=>{const g=u.original.user,f=(g==null?void 0:g.username)||"system";return o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(nt,{name:f,profilePictureUrl:(g==null?void 0:g.profilePictureUrl)||null,size:18}),e("span",{children:f})]})}},{header:"label",accessorKey:"label",size:100},{header:"score",accessorKey:"score",size:100},{header:"explanation",accessorKey:"explanation",cell:jy,size:400},{header:"source",accessorKey:"source",size:100},{header:"identifier",accessorKey:"identifier",size:100},{header:"metadata",accessorKey:"metadata",minSize:100,cell:({row:u})=>{const g=u.original.metadata;return g?e(Ga,{json:g,collapseSingleKey:!1}):"--"}},{header:"created at",accessorKey:"createdAt",size:100,cell:_e},{header:"updated at",accessorKey:"updatedAt",size:100,cell:_e},{header:"",accessorKey:"actions",size:100,cell:({row:u})=>e(Qy,{annotationId:u.original.id,spanNodeId:u.original.spanNodeId,annotationName:u.original.name,onSpanAnnotationActionSuccess:t,onSpanAnnotationActionError:g=>{i({title:"Failed to update span annotation",message:g.message})}})}],[i,t]),[s,d]=m.useState([{id:"createdAt",desc:!0}]),c=Ke({columns:r,data:l,getCoreRowModel:Te(),getSortedRowModel:ln(),onSortingChange:d,state:{sorting:s}}),y=c.getRowModel().rows.length===0;return e("div",{css:ub,children:o("table",{css:
|
|
2868
|
+
`;function mb({annotations:n,spanNodeId:a}){const l=m.useMemo(()=>n.map(u=>({...u,spanNodeId:a})),[n,a]),t=me(),i=ke(),r=m.useMemo(()=>[{header:"name",accessorKey:"name",size:100},{header:"annotator kind",accessorKey:"annotatorKind",size:100,cell:({row:u})=>{const g=u.original.annotatorKind;return e(Oy,{kind:g})}},{header:"user",accessorKey:"user",size:100,cell:({row:u})=>{const g=u.original.user,f=(g==null?void 0:g.username)||"system";return o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(nt,{name:f,profilePictureUrl:(g==null?void 0:g.profilePictureUrl)||null,size:18}),e("span",{children:f})]})}},{header:"label",accessorKey:"label",size:100},{header:"score",accessorKey:"score",size:100},{header:"explanation",accessorKey:"explanation",cell:jy,size:400},{header:"source",accessorKey:"source",size:100},{header:"identifier",accessorKey:"identifier",size:100},{header:"metadata",accessorKey:"metadata",minSize:100,cell:({row:u})=>{const g=u.original.metadata;return g?e(Ga,{json:g,collapseSingleKey:!1}):"--"}},{header:"created at",accessorKey:"createdAt",size:100,cell:_e},{header:"updated at",accessorKey:"updatedAt",size:100,cell:_e},{header:"",accessorKey:"actions",size:100,cell:({row:u})=>e(Qy,{annotationId:u.original.id,spanNodeId:u.original.spanNodeId,annotationName:u.original.name,onSpanAnnotationActionSuccess:t,onSpanAnnotationActionError:g=>{i({title:"Failed to update span annotation",message:g.message})}})}],[i,t]),[s,d]=m.useState([{id:"createdAt",desc:!0}]),c=Ke({columns:r,data:l,getCoreRowModel:Te(),getSortedRowModel:ln(),onSortingChange:d,state:{sorting:s}}),y=c.getRowModel().rows.length===0;return e("div",{css:ub,children:o("table",{css:He,"data-testid":"span-annotations-table",children:[e("thead",{children:c.getHeaderGroups().map(u=>e("tr",{children:u.headers.map(g=>e("th",{colSpan:g.colSpan,children:g.isPlaceholder?null:e(J,{children:o("div",{className:g.column.getCanSort()?"cursor-pointer":"",onClick:g.column.getToggleSortingHandler(),style:{display:"flex",alignItems:"center",left:g.getStart(),width:g.getSize()},children:[e(dn,{maxWidth:"100%",children:W(g.column.columnDef.header,g.getContext())}),g.column.getIsSorted()?e(_,{className:"sort-icon",svg:g.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]})})},g.id))},u.id))}),y?e(tn,{}):e("tbody",{children:c.getRowModel().rows.map(u=>e("tr",{children:u.getVisibleCells().map(g=>e("td",{style:{width:g.column.getSize()},children:W(g.column.columnDef.cell,g.getContext())},g.id))},u.id))})]})})}function gb({span:n}){const a=x.useFragment(qc,n),l=a.spanAnnotations;return a.spanAnnotations.length>0?e(mb,{annotations:l,spanNodeId:a.id}):e(cb,{})}function pb(n){return n==="__REDACTED__"}const yb=F`
|
|
2869
2869
|
position: relative;
|
|
2870
2870
|
overflow: hidden;
|
|
2871
2871
|
width: 200px;
|
|
@@ -2928,14 +2928,14 @@ fragment SpanFeedback_annotations on Span {
|
|
|
2928
2928
|
id
|
|
2929
2929
|
}
|
|
2930
2930
|
}
|
|
2931
|
-
`}}}();Hc.hash="9ff195bb3e4302feb10eb48b22dfdcb1";const $t={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function kb({spanId:n,onCompleted:a}){const[l,t]=m.useState(null),i=x.useLazyLoadQuery(Hc,{spanId:n},{fetchPolicy:"store-and-network"}),{span:{revision:r}}=i,[s,d]=x.useMutation(Uc),{control:c,setError:p,handleSubmit:y,formState:{isValid:u}}=Ve({defaultValues:{input:JSON.stringify(r==null?void 0:r.input,null,2),output:JSON.stringify(r==null?void 0:r.output,null,2),metadata:JSON.stringify(r==null?void 0:r.metadata,null,2),datasetId:""}}),g=m.useCallback(f=>{if(t(null),!Bn(f==null?void 0:f.input))return p("input",{message:"Input must be a valid JSON object"});if(!Bn(f==null?void 0:f.output))return p("output",{message:"Output must be a valid JSON object"});if(!Bn(f==null?void 0:f.metadata))return p("metadata",{message:"Metadata must be a valid JSON object"});if(!(f!=null&&f.datasetId))return p("datasetId",{message:"Dataset is required"});s({variables:{input:{datasetId:f.datasetId,examples:[{input:JSON.parse(f.input),output:JSON.parse(f.output),metadata:JSON.parse(f.metadata),spanId:n}]}},onCompleted:()=>{a(f.datasetId)},onError:k=>{const h=
|
|
2931
|
+
`}}}();Hc.hash="9ff195bb3e4302feb10eb48b22dfdcb1";const $t={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function kb({spanId:n,onCompleted:a}){const[l,t]=m.useState(null),i=x.useLazyLoadQuery(Hc,{spanId:n},{fetchPolicy:"store-and-network"}),{span:{revision:r}}=i,[s,d]=x.useMutation(Uc),{control:c,setError:p,handleSubmit:y,formState:{isValid:u}}=Ve({defaultValues:{input:JSON.stringify(r==null?void 0:r.input,null,2),output:JSON.stringify(r==null?void 0:r.output,null,2),metadata:JSON.stringify(r==null?void 0:r.metadata,null,2),datasetId:""}}),g=m.useCallback(f=>{if(t(null),!Bn(f==null?void 0:f.input))return p("input",{message:"Input must be a valid JSON object"});if(!Bn(f==null?void 0:f.output))return p("output",{message:"Output must be a valid JSON object"});if(!Bn(f==null?void 0:f.metadata))return p("metadata",{message:"Metadata must be a valid JSON object"});if(!(f!=null&&f.datasetId))return p("datasetId",{message:"Dataset is required"});s({variables:{input:{datasetId:f.datasetId,examples:[{input:JSON.parse(f.input),output:JSON.parse(f.output),metadata:JSON.parse(f.metadata),spanId:n}]}},onCompleted:()=>{a(f.datasetId)},onError:k=>{const h=Ie(k);t((h==null?void 0:h[0])??k.message)}})},[s,p,n,a]);return e(pn,{children:({close:f})=>o(Sl,{children:[o(kl,{children:[e(bl,{children:"Add Example to Dataset"}),o(mt,{children:[e(E,{variant:"primary",size:"S",isDisabled:!u||d,onPress:()=>{y(g)(),f()},leadingVisual:e(_,{svg:d?e(en,{}):e(da,{})}),children:"Add Example"}),e(Ci,{slot:"close"})]})]}),e("div",{css:F`
|
|
2932
2932
|
overflow-y: auto;
|
|
2933
2933
|
padding: var(--ac-global-dimension-size-400);
|
|
2934
2934
|
/* Make widths configurable */
|
|
2935
2935
|
.dataset-picker {
|
|
2936
2936
|
width: 100%;
|
|
2937
2937
|
}
|
|
2938
|
-
`,children:e(b,{direction:"row",justifyContent:"center",children:e(v,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:o(b,{direction:"column",gap:"size-200",children:[l?e(Fe,{variant:"danger",children:l}):null,e(H,{control:c,name:"datasetId",render:({field:{onChange:k,onBlur:h},fieldState:{invalid:S,error:K}})=>o(b,{direction:"row",gap:"size-100",alignItems:"end",children:[e(wo,{isRequired:!0,onSelectionChange:k,onBlur:h,validationState:S?"invalid":"valid",errorMessage:K==null?void 0:K.message,label:"Dataset"}),e(qy,{})]})}),e(H,{control:c,name:"input",render:({field:{onChange:k,onBlur:h,value:S},fieldState:{invalid:K,error:P}})=>o(B,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",...$t,children:[K?e(Fe,{variant:"danger",banner:!0,children:P==null?void 0:P.message}):null,e(on,{value:S,onChange:k,onBlur:h})]})}),e(H,{control:c,name:"output",render:({field:{onChange:k,onBlur:h,value:S},fieldState:{invalid:K,error:P}})=>o(B,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",...$t,backgroundColor:"green-100",borderColor:"green-700",children:[K?e(Fe,{variant:"danger",banner:!0,children:P==null?void 0:P.message}):null,e(on,{value:S,onChange:k,onBlur:h})]})}),e(H,{control:c,name:"metadata",render:({field:{onChange:k,onBlur:h,value:S},fieldState:{invalid:K,error:P}})=>o(B,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",...$t,children:[K?e(Fe,{variant:"danger",banner:!0,children:P==null?void 0:P.message}):null,e(on,{value:S,onChange:k,onBlur:h})]})})]})})})})]})})}const bb=n=>m.useMemo(()=>Qe(n),[n]),Sb=n=>n.events.some(a=>a.name==="exception"),
|
|
2938
|
+
`,children:e(b,{direction:"row",justifyContent:"center",children:e(v,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:o(b,{direction:"column",gap:"size-200",children:[l?e(Fe,{variant:"danger",children:l}):null,e(H,{control:c,name:"datasetId",render:({field:{onChange:k,onBlur:h},fieldState:{invalid:S,error:K}})=>o(b,{direction:"row",gap:"size-100",alignItems:"end",children:[e(wo,{isRequired:!0,onSelectionChange:k,onBlur:h,validationState:S?"invalid":"valid",errorMessage:K==null?void 0:K.message,label:"Dataset"}),e(qy,{})]})}),e(H,{control:c,name:"input",render:({field:{onChange:k,onBlur:h,value:S},fieldState:{invalid:K,error:P}})=>o(B,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",...$t,children:[K?e(Fe,{variant:"danger",banner:!0,children:P==null?void 0:P.message}):null,e(on,{value:S,onChange:k,onBlur:h})]})}),e(H,{control:c,name:"output",render:({field:{onChange:k,onBlur:h,value:S},fieldState:{invalid:K,error:P}})=>o(B,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",...$t,backgroundColor:"green-100",borderColor:"green-700",children:[K?e(Fe,{variant:"danger",banner:!0,children:P==null?void 0:P.message}):null,e(on,{value:S,onChange:k,onBlur:h})]})}),e(H,{control:c,name:"metadata",render:({field:{onChange:k,onBlur:h,value:S},fieldState:{invalid:K,error:P}})=>o(B,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",...$t,children:[K?e(Fe,{variant:"danger",banner:!0,children:P==null?void 0:P.message}):null,e(on,{value:S,onChange:k,onBlur:h})]})})]})})})})]})})}const bb=n=>m.useMemo(()=>Qe(n),[n]),Sb=n=>n.events.some(a=>a.name==="exception"),De={backgroundColor:"light",borderColor:"light",variant:"compact",collapsible:!0,bodyStyle:{padding:0}},vb=900,jt=33,Er="e";function Cb({spanNodeId:n}){const a=cn(p=>p.isAnnotatingSpans),l=cn(p=>p.setIsAnnotatingSpans),t=m.useRef(null),i=m.useRef(null),r=W1(i),s=r!=null&&r.width?r.width<vb:!0,{span:d}=x.useLazyLoadQuery(Dc,{id:n});if(d.__typename!=="Span")throw new Error("Expected a span, but got a different type"+d.__typename);ua(Er,()=>{a||l(!0)},{preventDefault:!0});const c=m.useMemo(()=>Sb(d),[d]);return o(Pn,{direction:"horizontal",autoSaveId:"span-details-layout",children:[e(Re,{order:1,children:o(b,{direction:"column",flex:"1 1 auto",height:"100%",ref:i,children:[e(v,{paddingTop:"size-100",paddingBottom:"size-50",paddingStart:"size-150",paddingEnd:"size-200",flex:"none",children:o(b,{direction:"row",alignItems:"center","data-testid":"span-header-row",children:[e(Z1,{span:d}),o(b,{flex:"none",direction:"row",alignItems:"center",gap:"size-100",children:[e(Wn,{variant:d.spanKind!=="llm"?"default":"primary",leadingVisual:e(_,{svg:e(wa,{})}),isDisabled:d.spanKind!=="llm",to:`/playground/spans/${d.id}`,size:"S","aria-label":"Prompt Playground",children:s?null:"Playground"}),e(Tb,{span:d,buttonText:s?null:"Add to Dataset"}),e(Fn,{size:"S",isSelected:a,onPress:()=>{l(!a);const p=t.current;p&&p.getSize()<jt&&p.resize(jt)},leadingVisual:e(_,{svg:e(Sa,{})}),trailingVisual:!s&&!a&&e(Ro,{children:Er}),children:s?null:"Annotate"}),e(X1,{traceId:d.trace.traceId,spanId:d.spanId})]})]})}),o(an,{children:[o(nn,{children:[e(ne,{id:"info",children:"Info"}),o(ne,{id:"annotations",children:["Annotations ",e(xn,{children:d.spanAnnotations.length})]}),e(ne,{id:"attributes",children:"Attributes"}),o(ne,{id:"events",children:["Events"," ",e(xn,{variant:c?"danger":"default",children:d.events.length})]})]}),e(oe,{id:"info",children:e(b,{direction:"row",height:"100%",children:e(Kb,{children:e(gt,{children:e(Pb,{span:d})})})})}),e(oe,{id:"annotations",children:e(gb,{span:d})}),e(oe,{id:"attributes",children:e(v,{padding:"size-200",height:"100%",maxHeight:"100%",overflow:"auto",children:e(B,{title:"All Attributes",...De,titleExtra:Jc,extra:e(de,{text:d.attributes}),children:e(pa,{children:d.attributes})})})}),e(oe,{id:"events",children:e(Qb,{events:d.events})})]})]})}),a&&e(Rn,{css:pt}),a&&e(Re,{order:2,ref:t,defaultSize:jt,minSize:10,collapsible:!0,onCollapse:()=>{l(!1)},children:e(sb,{span:d})})]})}const Fb=F`
|
|
2939
2939
|
flex: 1 1 auto;
|
|
2940
2940
|
overflow-y: auto;
|
|
2941
2941
|
// Overflow fails to take into account padding
|
|
@@ -2944,36 +2944,36 @@ fragment SpanFeedback_annotations on Span {
|
|
|
2944
2944
|
display: block;
|
|
2945
2945
|
height: var(--ac-global-dimension-static-size-400);
|
|
2946
2946
|
}
|
|
2947
|
-
`;function Kb({children:n}){return e("div",{css:Fb,"data-testid":"span-info-wrap",children:n})}function Tb({span:n,buttonText:a}){const l=me(),t=ce();return o(
|
|
2947
|
+
`;function Kb({children:n}){return e("div",{css:Fb,"data-testid":"span-info-wrap",children:n})}function Tb({span:n,buttonText:a}){const l=me(),t=ce();return o(Ue,{children:[e(E,{variant:"default",size:"S",leadingVisual:e(_,{svg:e(lt,{})}),children:a}),e(kp,{children:e(yn,{variant:"slideover",size:"L",children:e(m.Suspense,{fallback:e(ge,{}),children:e(kb,{spanId:n.id,onCompleted:i=>{l({title:"Span Added to Dataset",message:"Successfully added span to dataset",action:{text:"View Dataset",onClick:()=>{t(`/datasets/${i}/examples`)}}})}})})})})]})}function Pb({span:n}){const{spanKind:a,attributes:l}=n,{json:t,parseError:i}=bb(l),r=m.useMemo(()=>n.statusMessage?e(Fe,{variant:"danger",title:"Status Description",children:n.statusMessage}):null,[n]);if(i||!t)return e(v,{padding:"size-200",children:o(b,{direction:"column",gap:"size-200",children:[r,e(Fe,{variant:"warning",title:"Un-parsable attributes",children:`Failed to parse span attributes. ${i instanceof Error?i.message:""}`}),e(B,{...De,title:"Attributes",children:e(v,{padding:"size-100",children:l})})]})});let s;switch(a){case"llm":{s=e(xb,{span:n,spanAttributes:t});break}case"retriever":{s=e(Ib,{span:n,spanAttributes:t});break}case"reranker":{s=e(Db,{span:n,spanAttributes:t});break}case"embedding":{s=e(Lb,{span:n,spanAttributes:t});break}case"tool":{s=e(_b,{span:n,spanAttributes:t});break}default:s=e(Gc,{span:n})}return e(v,{padding:"size-200",children:o(b,{direction:"column",gap:"size-200",children:[r,s,t!=null&&t.metadata?e(B,{...De,title:"Metadata",children:e(pa,{children:JSON.stringify(t.metadata)})}):null]})})}function xb(n){const{spanAttributes:a,span:l}=n,{input:t,output:i}=l,r=m.useMemo(()=>a[ve.llm]||null,[a]),s=r==null?void 0:r[Be.provider],d=m.useMemo(()=>{if(r==null)return null;const w=r[Be.model_name];return typeof w=="string"?w:null},[r]),c=m.useMemo(()=>{if(r==null)return[];const w=r[Be.input_messages];return wr(w)?(w==null?void 0:w.map($=>$[ve.message]).filter(Boolean))||[]:[]},[r]),p=m.useMemo(()=>{if(r==null)return[];const w=r[Be.tools];return Array.isArray(w)?w==null?void 0:w.map(M=>M[ve.tool]).filter(Boolean):[]},[r]),y=m.useMemo(()=>p.reduce((w,$)=>($!=null&&$.json_schema&&w.push($.json_schema),w),[]),[p]),u=m.useMemo(()=>{if(r==null)return[];const w=r[Be.output_messages];return wr(w)?w.map($=>$[ve.message]).filter(Boolean)||[]:[]},[r]),g=m.useMemo(()=>{if(r==null)return[];const w=r[Be.prompts];return Hy(w)?w:[]},[r]),f=m.useMemo(()=>{if(r==null)return null;const w=r[Be.prompt_template];return w??null},[r]),k=m.useMemo(()=>r==null?"{}":r[Be.invocation_parameters]||"{}",[r]),h=m.useMemo(()=>{if(d==null)return null;let w=e(Ki,{spanKind:"llm"});const $=s==null?void 0:s.toUpperCase();return typeof $=="string"&&Lc($)&&(w=e(et,{provider:$})),o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[w,e(C,{size:"M",weight:"heavy",children:d})]})},[d,s]),S=t!=null&&t.value!=null,K=c.length>0,P=y.length>0,I=i!=null&&i.value!=null,D=u.length>0,T=g.length>0,L=Object.keys(Qe(k).json||{}).length>0,V=f!=null;return o(b,{direction:"column",gap:"size-200",children:[e(B,{collapsible:!0,backgroundColor:"light",borderColor:"light",bodyStyle:{padding:0},titleSeparator:!1,variant:"compact",title:h,children:o(an,{children:[o(nn,{children:[K&&e(ne,{id:"input-messages",children:"Input Messages"}),P&&e(ne,{id:"tools",children:"Tools"}),S&&e(ne,{id:"input",children:"Input"}),V&&e(ne,{id:"prompt-template",children:"Prompt Template"}),T&&e(ne,{id:"prompts",children:"Prompts"}),L&&e(ne,{id:"invocation-params",children:"Invocation Params"})]}),K&&e(oe,{id:"input-messages",children:e(Mr,{messages:c})}),P&&e(oe,{id:"tools",children:e(Eb,{toolSchemas:y})}),S&&e(oe,{id:"input",children:e(v,{padding:"size-200",children:e(vn,{children:e(B,{...De,title:"LLM Input",extra:o(b,{direction:"row",gap:"size-100",children:[e(Vn,{}),e(de,{text:t.value})]}),children:e(Un,{...t})})})})}),V&&e(oe,{id:"prompt-template",children:e(v,{padding:"size-200",children:o(b,{direction:"column",gap:"size-100",children:[e(v,{borderRadius:"medium",borderColor:"light",backgroundColor:"light",borderWidth:"thin",padding:"size-200",children:o(jl,{text:f.template,children:[e(C,{color:"text-700",fontStyle:"italic",children:"prompt template"}),e(Wc,{children:f.template})]})}),e(v,{borderRadius:"medium",borderColor:"light",backgroundColor:"light",borderWidth:"thin",padding:"size-200",children:o(jl,{text:JSON.stringify(f.variables),children:[e(C,{color:"text-700",fontStyle:"italic",children:"template variables"}),e(pa,{children:JSON.stringify(f.variables)})]})})]})})}),T&&e(oe,{id:"prompts",children:e(Mb,{prompts:g})}),L&&e(oe,{id:"invocation-params",children:e(jl,{text:k,padding:"size-100",children:e(pa,{children:k})})})]})}),I||D?e(oi,{...De,children:o(an,{children:[o(nn,{children:[D&&e(ne,{id:"output-messages",children:"Output Messages"}),I&&e(ne,{id:"output",children:"Output"})]}),D&&e(oe,{id:"output-messages",children:e(Mr,{messages:u})}),I&&e(oe,{id:"output",children:e(v,{padding:"size-200",children:e(vn,{children:e(B,{...De,title:"LLM Output",extra:o(b,{direction:"row",gap:"size-100",children:[e(Vn,{}),e(de,{text:i.value})]}),children:e(Un,{...i})})})})})]})}):null]})}function Ib(n){const{spanAttributes:a,span:l}=n,{input:t}=l,i=m.useMemo(()=>a[ve.retrieval]||null,[a]),r=m.useMemo(()=>{var u;return i==null?[]:((u=i[bp.documents])==null?void 0:u.map(g=>g[ve.document]).filter(Boolean))||[]},[i]),s=m.useMemo(()=>l.documentEvaluations.reduce((g,f)=>{const k=f.documentPosition,h=g[k]||[];return{...g,[k]:[...h,f]}},{}),[l.documentEvaluations]),d=t!=null&&t.value!=null,c=d&&t.mimeType==="text",p=r.length>0,y=l.documentRetrievalMetrics.length>0;return o(b,{direction:"column",gap:"size-200",children:[d?e(vn,{children:e(B,{title:"Input",...De,extra:e(b,{direction:"row",gap:"size-100",alignItems:"center",children:c?e(Vn,{}):e(de,{text:t.value})}),children:e(Un,{...t})})}):null,p?e(vn,{children:e(B,{title:"Documents",...De,titleExtra:y&&e(b,{direction:"row",alignItems:"center",gap:"size-100",children:l.documentRetrievalMetrics.map(u=>o(J,{children:[e(kn,{name:u.evaluationName,metric:"ndcg",score:u.ndcg},"ndcg"),e(kn,{name:u.evaluationName,metric:"precision",score:u.precision},"precision"),e(kn,{name:u.evaluationName,metric:"hit",score:u.hit},"hit")]}))}),extra:e(Vn,{}),children:e("ul",{css:F`
|
|
2948
2948
|
display: flex;
|
|
2949
2949
|
flex-direction: column;
|
|
2950
2950
|
gap: var(--ac-global-dimension-static-size-200);
|
|
2951
2951
|
padding: var(--ac-global-dimension-static-size-200);
|
|
2952
|
-
`,children:r.map((u,g)=>e("li",{children:e(ei,{document:u,documentEvaluations:s[g],borderColor:"seafoam-700",backgroundColor:"seafoam-100",tokenColor:"var(--ac-global-color-seafoam-1000)"})},g))})})}):null]})}function Db(n){const{spanAttributes:a}=n,l=m.useMemo(()=>a[ve.reranker]||null,[a]),t=m.useMemo(()=>l==null?null:l[_t.query]||null,[l]),i=m.useMemo(()=>{var c;return l==null?[]:((c=l[_t.input_documents])==null?void 0:c.map(p=>p[ve.document]).filter(Boolean))||[]},[l]),r=m.useMemo(()=>{var c;return l==null?[]:((c=l[_t.output_documents])==null?void 0:c.map(p=>p[ve.document]).filter(Boolean))||[]},[l]),s=i.length,d=r.length;return o(b,{direction:"column",gap:"size-200",children:[e(vn,{children:t&&e(B,{title:"Query",...
|
|
2952
|
+
`,children:r.map((u,g)=>e("li",{children:e(ei,{document:u,documentEvaluations:s[g],borderColor:"seafoam-700",backgroundColor:"seafoam-100",tokenColor:"var(--ac-global-color-seafoam-1000)"})},g))})})}):null]})}function Db(n){const{spanAttributes:a}=n,l=m.useMemo(()=>a[ve.reranker]||null,[a]),t=m.useMemo(()=>l==null?null:l[_t.query]||null,[l]),i=m.useMemo(()=>{var c;return l==null?[]:((c=l[_t.input_documents])==null?void 0:c.map(p=>p[ve.document]).filter(Boolean))||[]},[l]),r=m.useMemo(()=>{var c;return l==null?[]:((c=l[_t.output_documents])==null?void 0:c.map(p=>p[ve.document]).filter(Boolean))||[]},[l]),s=i.length,d=r.length;return o(b,{direction:"column",gap:"size-200",children:[e(vn,{children:t&&e(B,{title:"Query",...De,children:e(v,{padding:"size-200",children:e(Da,{children:t})})})}),e(B,{title:"Input Documents",titleExtra:e(xn,{children:s}),...De,defaultOpen:!1,bodyStyle:{padding:0},children:e("ul",{css:F`
|
|
2953
2953
|
padding: var(--ac-global-dimension-static-size-200);
|
|
2954
2954
|
display: flex;
|
|
2955
2955
|
flex-direction: column;
|
|
2956
2956
|
gap: var(--ac-global-dimension-static-size-200);
|
|
2957
|
-
`,children:i.map((c,p)=>e("li",{children:e(ei,{document:c,borderColor:"seafoam-700",backgroundColor:"seafoam-100",tokenColor:"var(--ac-global-color-seafoam-1000)"})},p))})}),e(B,{title:"Output Documents",titleExtra:e(xn,{children:d}),...
|
|
2957
|
+
`,children:i.map((c,p)=>e("li",{children:e(ei,{document:c,borderColor:"seafoam-700",backgroundColor:"seafoam-100",tokenColor:"var(--ac-global-color-seafoam-1000)"})},p))})}),e(B,{title:"Output Documents",titleExtra:e(xn,{children:d}),...De,bodyStyle:{padding:0},children:e("ul",{css:F`
|
|
2958
2958
|
padding: var(--ac-global-dimension-static-size-200);
|
|
2959
2959
|
display: flex;
|
|
2960
2960
|
flex-direction: column;
|
|
2961
2961
|
gap: var(--ac-global-dimension-static-size-200);
|
|
2962
|
-
`,children:r.map((c,p)=>e("li",{children:e(ei,{document:c,borderColor:"celery-700",backgroundColor:"celery-100",tokenColor:"var(--ac-global-color-celery-1000)"})},p))})})]})}function Lb(n){const{spanAttributes:a}=n,l=m.useMemo(()=>a[ve.embedding]||null,[a]),t=m.useMemo(()=>{var s;return l==null?[]:((s=l[At.embeddings])==null?void 0:s.map(d=>d[ve.embedding]).filter(Boolean))||[]},[l]),i=t.length>0,r=l==null?void 0:l[At.model_name];return e(b,{direction:"column",gap:"size-200",children:i?e(B,{title:"Embeddings"+(typeof r=="string"?`: ${r}`:""),...
|
|
2962
|
+
`,children:r.map((c,p)=>e("li",{children:e(ei,{document:c,borderColor:"celery-700",backgroundColor:"celery-100",tokenColor:"var(--ac-global-color-celery-1000)"})},p))})})]})}function Lb(n){const{spanAttributes:a}=n,l=m.useMemo(()=>a[ve.embedding]||null,[a]),t=m.useMemo(()=>{var s;return l==null?[]:((s=l[At.embeddings])==null?void 0:s.map(d=>d[ve.embedding]).filter(Boolean))||[]},[l]),i=t.length>0,r=l==null?void 0:l[At.model_name];return e(b,{direction:"column",gap:"size-200",children:i?e(B,{title:"Embeddings"+(typeof r=="string"?`: ${r}`:""),...De,children:e("ul",{css:F`
|
|
2963
2963
|
display: flex;
|
|
2964
2964
|
flex-direction: column;
|
|
2965
2965
|
gap: var(--ac-global-dimension-static-size-200);
|
|
2966
2966
|
padding: var(--ac-global-dimension-static-size-200);
|
|
2967
|
-
`,children:t.map((s,d)=>e("li",{children:e(vn,{children:e(B,{...
|
|
2967
|
+
`,children:t.map((s,d)=>e("li",{children:e(vn,{children:e(B,{...De,backgroundColor:"purple-100",borderColor:"purple-700",title:"Embedded Text",children:e(Da,{children:s[At.text]||""})})})},d))})}):e(Gc,{span:n.span})})}function _b(n){const{span:a,spanAttributes:l}=n,{input:t,output:i}=a,r=typeof(t==null?void 0:t.value)=="string",s=typeof(i==null?void 0:i.value)=="string",d=(t==null?void 0:t.mimeType)==="text",c=(i==null?void 0:i.mimeType)==="text",p=m.useMemo(()=>l[ve.tool]||{},[l]),y=Object.keys(p).length>0,u=p[Nl.name],g=p[Nl.description],f=p[Nl.parameters];return!r&&!s&&!y?null:o(b,{direction:"column",gap:"size-200",children:[r?e(vn,{children:e(B,{title:"Input",...De,extra:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[d?e(Vn,{}):null,e(de,{text:t.value})]}),children:e(Un,{...t})})}):null,s?e(vn,{children:e(B,{title:"Output",...De,backgroundColor:"green-100",borderColor:"green-700",extra:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[c?e(Vn,{}):null,e(de,{text:i.value})]}),children:e(Un,{...i})})}):null,y?e(B,{title:"Tool"+(typeof u=="string"?`: ${u}`:""),...De,children:o(b,{direction:"column",children:[g!=null?e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",backgroundColor:"light",children:o(b,{direction:"column",alignItems:"start",gap:"size-50",children:[e(C,{color:"text-700",fontStyle:"italic",children:"Description"}),e(C,{children:g})]})}):null,f!=null?e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",children:o(b,{direction:"column",alignItems:"start",width:"100%",children:[e(C,{color:"text-700",fontStyle:"italic",children:"Parameters"}),e("div",{css:F`
|
|
2968
2968
|
.cm-editor {
|
|
2969
2969
|
background-color: transparent !important;
|
|
2970
2970
|
}
|
|
2971
|
-
`,children:e(pa,{basicSetup:{lineNumbers:!1,foldGutter:!1},children:JSON.stringify(f)})})]})}):null]})}):null]})}const Ab=["irrelevant","unrelated"];function ei({document:n,documentEvaluations:a,backgroundColor:l,borderColor:t,tokenColor:i}){const r=n[nl.metadata],s=a&&a.length,d=n[nl.content];return e(B,{...
|
|
2971
|
+
`,children:e(pa,{basicSetup:{lineNumbers:!1,foldGutter:!1},children:JSON.stringify(f)})})]})}):null]})}):null]})}const Ab=["irrelevant","unrelated"];function ei({document:n,documentEvaluations:a,backgroundColor:l,borderColor:t,tokenColor:i}){const r=n[nl.metadata],s=a&&a.length,d=n[nl.content];return e(B,{...De,backgroundColor:l,borderColor:t,bodyStyle:{padding:0},title:o(b,{direction:"row",gap:"size-50",alignItems:"center",children:[e(_,{svg:e(Eo,{})}),o(ae,{level:4,children:["document ",n[nl.id]]})]}),extra:typeof n[nl.score]=="number"&&e(Cn,{color:i,children:`score ${Fi(n[nl.score])}`}),children:o(b,{direction:"column",children:[d&&e(Da,{children:d}),r&&e(J,{children:o(v,{borderColor:t,borderTopWidth:"thin",children:[e(v,{paddingX:"size-200",paddingY:"size-100",borderColor:t,borderBottomWidth:"thin",children:e(ae,{level:4,children:"Document Metadata"})}),e(pa,{basicSetup:{lineNumbers:!1},children:JSON.stringify(r)})]})}),s&&e(v,{borderColor:t,borderTopWidth:"thin",padding:"size-200",children:o(b,{direction:"column",gap:"size-100",children:[e(ae,{level:3,weight:"heavy",children:"Evaluations"}),e("ul",{children:a.map((c,p)=>{const y=c.label&&Ab.includes(c.label)?"var(--ac-global-color-danger)":i;return e("li",{children:e(v,{padding:"size-200",borderWidth:"thin",borderColor:t,borderRadius:"medium",children:o(b,{direction:"column",gap:"size-50",children:[o(b,{direction:"row",gap:"size-100",children:[e(C,{weight:"heavy",elementType:"h5",children:c.name}),c.label&&e(Cn,{color:y,children:c.label}),typeof c.score=="number"&&e(Cn,{color:y,children:o(b,{direction:"row",gap:"size-50",children:[e(C,{size:"XS",weight:"heavy",color:"inherit",children:"score"}),e(C,{size:"XS",children:za(c.score)})]})})]}),typeof c.explanation&&e("p",{css:F`
|
|
2972
2972
|
margin-top: var(
|
|
2973
2973
|
--ac-global-dimension-static-size-100
|
|
2974
2974
|
);
|
|
2975
2975
|
margin-bottom: 0;
|
|
2976
|
-
`,children:c.explanation})]})})},p)})})]})})]})})}function wb({message:n}){var p;const a=n[ze.content],l=n[ze.contents],t=(p=n[ze.tool_calls])==null?void 0:p.map(y=>y[ve.tool_call]).filter(Boolean),i=n[ze.function_call_arguments_json]&&n[ze.function_call_name],r=n[ze.role]||"unknown",s=Dl(r),d=m.useMemo(()=>(t==null?void 0:t.map((y,u)=>`tool-call-${u}`))||[],[t]),c=n[ze.tool_call_id];return e(vn,{children:o(B,{...
|
|
2976
|
+
`,children:c.explanation})]})})},p)})})]})})]})})}function wb({message:n}){var p;const a=n[ze.content],l=n[ze.contents],t=(p=n[ze.tool_calls])==null?void 0:p.map(y=>y[ve.tool_call]).filter(Boolean),i=n[ze.function_call_arguments_json]&&n[ze.function_call_name],r=n[ze.role]||"unknown",s=Dl(r),d=m.useMemo(()=>(t==null?void 0:t.map((y,u)=>`tool-call-${u}`))||[],[t]),c=n[ze.tool_call_id];return e(vn,{children:o(B,{...De,...s,title:r+(n[ze.name]?`: ${n[ze.name]}`:""),extra:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Vn,{}),e(de,{text:a||JSON.stringify(n)})]}),children:[e(gt,{children:l?e(zb,{messageContents:l}):null}),e(b,{direction:"column",alignItems:"start",children:o(bn,{css:F`
|
|
2977
2977
|
width: 100%;
|
|
2978
2978
|
// when any .ac-disclosure-trigger is hovered, show the child .copy-to-clipboard-button
|
|
2979
2979
|
.ac-disclosure-trigger {
|
|
@@ -2999,7 +2999,7 @@ fragment SpanFeedback_annotations on Span {
|
|
|
2999
2999
|
`,children:[(h=y==null?void 0:y.function)==null?void 0:h.name,"(",f.json?JSON.stringify(f.json,null,2):`${(S=y==null?void 0:y.function)==null?void 0:S.arguments}`,")"]},u)})]},u)}):null,i?o(fe,{id:"function-call",children:[e(pe,{children:e(C,{children:"Function Call"})}),e(ye,{children:o("pre",{css:F`
|
|
3000
3000
|
text-wrap: wrap;
|
|
3001
3001
|
margin: var(--ac-global-dimension-static-size-100) 0;
|
|
3002
|
-
`,children:[n[ze.function_call_name],"(",JSON.stringify(JSON.parse(n[ze.function_call_arguments_json]),null,2),")"]})})]}):null]})})]})})}function Rb({toolSchema:n,index:a}){return e(B,{title:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Ki,{spanKind:"tool"}),e(C,{weight:"heavy",children:"Tool"})]}),titleExtra:o(xn,{children:["#",a+1]}),...
|
|
3002
|
+
`,children:[n[ze.function_call_name],"(",JSON.stringify(JSON.parse(n[ze.function_call_arguments_json]),null,2),")"]})})]}):null]})})]})})}function Rb({toolSchema:n,index:a}){return e(B,{title:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Ki,{spanKind:"tool"}),e(C,{weight:"heavy",children:"Tool"})]}),titleExtra:o(xn,{children:["#",a+1]}),...De,backgroundColor:"yellow-100",borderColor:"yellow-700",bodyStyle:{padding:0},extra:e(de,{text:n}),children:e(Un,{value:n,mimeType:"json"})})}function Mr({messages:n}){return e("ul",{css:F`
|
|
3003
3003
|
display: flex;
|
|
3004
3004
|
flex-direction: column;
|
|
3005
3005
|
gap: var(--ac-global-dimension-static-size-100);
|
|
@@ -3026,7 +3026,7 @@ fragment SpanFeedback_annotations on Span {
|
|
|
3026
3026
|
white-space: pre-wrap;
|
|
3027
3027
|
padding: 0;
|
|
3028
3028
|
margin: 0;
|
|
3029
|
-
`,children:l}):null,i?e(fb,{url:i}):null]})}function Gc({span:n}){const{input:a,output:l}=n,t=a==null&&l==null,i=(a==null?void 0:a.mimeType)==="text",r=(l==null?void 0:l.mimeType)==="text";return o(b,{direction:"column",gap:"size-200",children:[a&&a.value!=null?e(vn,{children:e(B,{title:"Input",...
|
|
3029
|
+
`,children:l}):null,i?e(fb,{url:i}):null]})}function Gc({span:n}){const{input:a,output:l}=n,t=a==null&&l==null,i=(a==null?void 0:a.mimeType)==="text",r=(l==null?void 0:l.mimeType)==="text";return o(b,{direction:"column",gap:"size-200",children:[a&&a.value!=null?e(vn,{children:e(B,{title:"Input",...De,extra:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[i?e(Vn,{}):null,e(de,{text:a.value})]}),children:e(Un,{...a})})}):null,l&&l.value!=null?e(vn,{children:e(B,{title:"Output",...De,backgroundColor:"green-100",borderColor:"green-700",extra:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[r?e(Vn,{}):null,e(de,{text:l.value})]}),children:e(Un,{...l})})}):null,t?e(B,{title:"All Attributes",titleExtra:Jc,...De,extra:e(de,{text:n.attributes}),children:e(pa,{children:n.attributes})}):null]})}const jb=F`
|
|
3030
3030
|
width: 100%;
|
|
3031
3031
|
.cm-editor,
|
|
3032
3032
|
.cm-gutters {
|
|
@@ -3125,7 +3125,7 @@ fragment AnnotationSummaryGroup on Span {
|
|
|
3125
3125
|
fragment TraceHeaderRootSpanAnnotationsFragment on Span {
|
|
3126
3126
|
...AnnotationSummaryGroup
|
|
3127
3127
|
}
|
|
3128
|
-
`}}}();Xc.hash="1b00ac674154cf26ad588b2f17f82305";function Bb({spanId:n}){const a=x.useLazyLoadQuery(Xc,{spanId:n},{fetchPolicy:"store-and-network"}),l=x.useFragment(Zc,a.span);return e(Gy,{span:l,renderEmptyState:()=>null})}function qb(n){const a=n.find(i=>i.parentId==null);if(a)return a;const l=new Set(n.map(i=>i.spanId)),t=n.filter(i=>i.parentId!=null&&!l.has(i.parentId));return t.length===1?t[0]:null}function Hi(n){var u,g;const{traceId:a,projectId:l}=n,[t,i]=
|
|
3128
|
+
`}}}();Xc.hash="1b00ac674154cf26ad588b2f17f82305";function Bb({spanId:n}){const a=x.useLazyLoadQuery(Xc,{spanId:n},{fetchPolicy:"store-and-network"}),l=x.useFragment(Zc,a.span);return e(Gy,{span:l,renderEmptyState:()=>null})}function qb(n){const a=n.find(i=>i.parentId==null);if(a)return a;const l=new Set(n.map(i=>i.spanId)),t=n.filter(i=>i.parentId!=null&&!l.has(i.parentId));return t.length===1?t[0]:null}function Hi(n){var u,g;const{traceId:a,projectId:l}=n,[t,i]=mn(),r=x.useLazyLoadQuery(Ic,{traceId:a,id:l},{fetchPolicy:"store-and-network"}),s=((u=r.project.trace)==null?void 0:u.latencyMs)!=null?r.project.trace.latencyMs:null,d=m.useMemo(()=>{var k;return(((k=r.project.trace)==null?void 0:k.spans.edges)||[]).map(h=>h.span)},[r]),p=t.get(un)??d[0].id,y=m.useMemo(()=>qb(d),[d]);return o("main",{css:F`
|
|
3129
3129
|
flex: 1 1 auto;
|
|
3130
3130
|
overflow: hidden;
|
|
3131
3131
|
display: flex;
|
|
@@ -3133,7 +3133,7 @@ fragment TraceHeaderRootSpanAnnotationsFragment on Span {
|
|
|
3133
3133
|
`,children:[e(Ub,{rootSpan:y,latencyMs:s,sessionId:(g=r.project.trace)==null?void 0:g.projectSessionId}),o(Pn,{direction:"horizontal",autoSaveId:"trace-panel-group",css:F`
|
|
3134
3134
|
flex: 1 1 auto;
|
|
3135
3135
|
overflow: hidden;
|
|
3136
|
-
`,children:[e(Re,{defaultSize:30,minSize:5,children:e(Gb,{children:e(Wy,{spans:d,selectedSpanNodeId:p,onSpanClick:f=>{i(k=>(k.set(
|
|
3136
|
+
`,children:[e(Re,{defaultSize:30,minSize:5,children:e(Gb,{children:e(Wy,{spans:d,selectedSpanNodeId:p,onSpanClick:f=>{i(k=>(k.set(un,f.id),k),{replace:!0})}})})}),e(Rn,{css:pt}),e(Re,{children:e(Hb,{children:p?e(m.Suspense,{fallback:e(ge,{}),children:e(Cb,{spanNodeId:p})}):null})})]})]})}function Ub({rootSpan:n,latencyMs:a,sessionId:l}){const{projectId:t}=Oe(),{statusCode:i}=n??{statusCode:"UNSET"},r=Jy(i);return e(v,{paddingTop:"size-100",paddingBottom:"size-150",paddingX:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",children:o(b,{direction:"row",gap:"size-400",alignItems:"center",css:F`
|
|
3137
3137
|
box-sizing: content-box;
|
|
3138
3138
|
`,children:[o(b,{direction:"column",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Trace Status"}),e(C,{size:"XL",children:o(b,{direction:"row",gap:"size-50",alignItems:"center",children:[e(ot,{statusCode:i}),e(C,{size:"L",color:r,children:i})]})})]}),o(b,{direction:"column",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Latency"}),e(C,{size:"XL",children:typeof a=="number"?e($e,{latencyMs:a,size:"L"}):"--"})]}),n?e(Bb,{spanId:n.id}):null,l&&e("span",{css:F`
|
|
3139
3139
|
margin-left: auto;
|
|
@@ -3160,13 +3160,13 @@ fragment TraceHeaderRootSpanAnnotationsFragment on Span {
|
|
|
3160
3160
|
`,children:n})}function Gb({children:n}){return e("div",{"data-testid":"scrolling-panel-content",css:F`
|
|
3161
3161
|
height: 100%;
|
|
3162
3162
|
overflow-y: auto;
|
|
3163
|
-
`,children:n})}const It=()=>{const{projectId:n}=Oe();if(!n)throw new Error("projectId is required");const l=Ba().pathname.split("/"),t=l.indexOf(n);if(t===-1)throw new Error("projectId not found in path");const i=l.slice(0,t+1).join("/"),r=l[t+1];return{rootPath:i,tab:r}},Yc=m.createContext(null),Gi=()=>m.useContext(Yc),eu=(n,a)=>{const l=n.findIndex(({traceId:d,spanId:c})=>a&&(d===a||c===a)),t=l-1,i=l+1,r=n[t],s=n[i];return{nextTraceId:s==null?void 0:s.traceId,nextSpanId:s==null?void 0:s.spanId,previousTraceId:r==null?void 0:r.traceId,previousSpanId:r==null?void 0:r.spanId}},Vr=(n,a,l)=>{const{nextTraceId:t,previousTraceId:i,nextSpanId:r,previousSpanId:s}=eu(a,l),[d,c,p]=n.pathname.split("/").filter(f=>f!==""),y=(f,k)=>{let h=`/${d}/${c}/${p}/${f}`;return k&&(h+=`?${
|
|
3163
|
+
`,children:n})}const It=()=>{const{projectId:n}=Oe();if(!n)throw new Error("projectId is required");const l=Ba().pathname.split("/"),t=l.indexOf(n);if(t===-1)throw new Error("projectId not found in path");const i=l.slice(0,t+1).join("/"),r=l[t+1];return{rootPath:i,tab:r}},Yc=m.createContext(null),Gi=()=>m.useContext(Yc),eu=(n,a)=>{const l=n.findIndex(({traceId:d,spanId:c})=>a&&(d===a||c===a)),t=l-1,i=l+1,r=n[t],s=n[i];return{nextTraceId:s==null?void 0:s.traceId,nextSpanId:s==null?void 0:s.spanId,previousTraceId:r==null?void 0:r.traceId,previousSpanId:r==null?void 0:r.spanId}},Vr=(n,a,l)=>{const{nextTraceId:t,previousTraceId:i,nextSpanId:r,previousSpanId:s}=eu(a,l),[d,c,p]=n.pathname.split("/").filter(f=>f!==""),y=(f,k)=>{let h=`/${d}/${c}/${p}/${f}`;return k&&(h+=`?${un}=${k}`),h},u=!!t,g=!!i;return{nextTracePath:u?y(t,r):null,previousTracePath:g?y(i,s):null}},nu=({children:n})=>{const a=ce(),l=Ba(),[t,i]=m.useState([]),r=m.useCallback(d=>{const{nextTracePath:c}=Vr(l,t,d);c&&a(c)},[a,l,t]),s=m.useCallback(d=>{const{previousTracePath:c}=Vr(l,t,d);c&&a(c)},[a,l,t]);return e(Yc.Provider,{value:{traceSequence:t,next:r,previous:s,setTraceSequence:i},children:n})},zr="j",Nr="k",Wb=({currentId:n})=>{const a=Gi();if(ua(zr,()=>{a&&a.next(n)}),ua(Nr,()=>{a&&a.previous(n)}),!a||!a.traceSequence.length)return null;const{previous:l,next:t,traceSequence:i}=a,{nextTraceId:r,previousTraceId:s}=eu(i,n),d=!!s,c=!!r;return e(b,{gap:"size-50",css:F`
|
|
3164
3164
|
button {
|
|
3165
3165
|
// either the icons or the trigger wrap are making the buttons slightly too small
|
|
3166
3166
|
// so just spot adjust the min height here
|
|
3167
3167
|
min-height: 31px;
|
|
3168
3168
|
}
|
|
3169
|
-
`,children:o(b,{direction:"row",gap:"size-50",alignItems:"center",children:[o(Ql,{delay:100,children:[e(E,{size:"S",id:"next",leadingVisual:e(_,{svg:e(Zy,{})}),"aria-label":"Next trace",isDisabled:!c,onPress:()=>{m.startTransition(()=>{t(n)})}}),e(Bl,{offset:4,children:e(v,{backgroundColor:"dark",borderWidth:"thin",borderColor:"dark",borderRadius:"medium",padding:"size-100",children:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("span",{children:"Next trace"}),e(fl,{children:zr})]})})})]}),o(Ql,{delay:100,children:[e(E,{size:"S",id:"previous",leadingVisual:e(_,{svg:e(Xy,{})}),"aria-label":"Previous trace",isDisabled:!d,onPress:()=>{m.startTransition(()=>{l(n)})}}),e(Bl,{offset:4,children:e(v,{backgroundColor:"dark",borderWidth:"thin",borderColor:"dark",borderRadius:"medium",padding:"size-100",children:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("span",{children:"Previous trace"}),e(fl,{children:Nr})]})})})]})]})})};function yT(){const{traceId:n,projectId:a}=Oe(),[l]=
|
|
3169
|
+
`,children:o(b,{direction:"row",gap:"size-50",alignItems:"center",children:[o(Ql,{delay:100,children:[e(E,{size:"S",id:"next",leadingVisual:e(_,{svg:e(Zy,{})}),"aria-label":"Next trace",isDisabled:!c,onPress:()=>{m.startTransition(()=>{t(n)})}}),e(Bl,{offset:4,children:e(v,{backgroundColor:"dark",borderWidth:"thin",borderColor:"dark",borderRadius:"medium",padding:"size-100",children:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("span",{children:"Next trace"}),e(fl,{children:zr})]})})})]}),o(Ql,{delay:100,children:[e(E,{size:"S",id:"previous",leadingVisual:e(_,{svg:e(Xy,{})}),"aria-label":"Previous trace",isDisabled:!d,onPress:()=>{m.startTransition(()=>{l(n)})}}),e(Bl,{offset:4,children:e(v,{backgroundColor:"dark",borderWidth:"thin",borderColor:"dark",borderRadius:"medium",padding:"size-100",children:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("span",{children:"Previous trace"}),e(fl,{children:Nr})]})})})]})]})})};function yT(){const{traceId:n,projectId:a}=Oe(),[l]=mn(),t=ce(),{rootPath:i,tab:r}=It(),d=l.get(un)||n;return e(yn,{variant:"slideover",size:"fullscreen",isOpen:!0,isDismissable:!0,shouldCloseOnInteractOutside:()=>!1,onOpenChange:c=>{c||t(`${i}/${r}`)},children:e(pn,{children:({close:c})=>o(Sl,{children:[o(kl,{children:[e(bl,{children:"Trace Details"}),o(mt,{children:[e(Wb,{currentId:d}),e(Yy,{preserveSearchParams:!0,buttonText:"Share",tooltipText:"Copy trace link to clipboard",successText:"Trace link copied to clipboard"}),e(Ci,{close:c})]})]}),e(m.Suspense,{fallback:e(ge,{}),children:e(Hi,{traceId:n,projectId:a})})]})})})}function au({traceId:n,projectId:a,title:l}){return e(pn,{children:({close:t})=>o(Sl,{children:[o(kl,{children:[e(bl,{children:l}),o(mt,{children:[e(Wn,{size:"S",to:`/projects/${a}/traces/${n}`,children:"View Trace in Project"}),e(Ci,{close:t})]})]}),e(m.Suspense,{fallback:e(ge,{}),children:e(Hi,{traceId:n,projectId:a})})]})})}const Jb=n=>{const a=n;return ma(a.function)?typeof a.function.arguments=="string":!1};function lu({toolCall:n}){const a=m.useMemo(()=>{const{provider:l,validatedToolCall:t}=ef(n);switch(l){case"OPENAI":case"AZURE_OPENAI":return{name:t.function.name,input:t.function.arguments};case"ANTHROPIC":return{name:t.name,input:t.input};case"UNKNOWN":{if(!Jb(n))return null;const{json:i}=Qe(n.function.arguments);return{name:n.function.name??"",input:ma(i)?i:n.function.arguments}}default:return Pe()}},[n]);return a==null?o(C,{children:["Invalid tool call format: ",JSON.stringify(n)]}):o("pre",{css:F`
|
|
3170
3170
|
text-wrap: wrap;
|
|
3171
3171
|
margin: var(--ac-global-dimension-static-size-100) 0;
|
|
3172
3172
|
`,children:[a.name,"(",typeof a.input=="string"?a.input:JSON.stringify(a.input,null,2),")"]})}const Zb=10,Xb=n=>n.examples.reduce((a,l)=>{const{datasetExampleId:t,result:i,experimentRunId:r}=l,s={experimentRunId:r};switch(i.__typename){case"ChatCompletionMutationError":return{...a,[t]:{...s,errorMessage:i.message}};case"ChatCompletionMutationPayload":{const{errorMessage:d,content:c,span:p,toolCalls:y}=i;return{...a,[t]:{...s,span:p,content:c,errorMessage:d,toolCalls:y.reduce((u,g)=>(u[g.id]=g,u),{})}}}case"%other":return a;default:Pe()}},{}),Yb=F`
|
|
@@ -3202,13 +3202,13 @@ fragment TraceHeaderRootSpanAnnotationsFragment on Span {
|
|
|
3202
3202
|
overflow-y: auto;
|
|
3203
3203
|
padding: var(--ac-global-dimension-static-size-100)
|
|
3204
3204
|
var(--ac-global-dimension-static-size-200);
|
|
3205
|
-
`,children:n})}function nS({getValue:n,collapseSingleKey:a}){const l=n();return e(iu,{children:e(Ga,{json:l,space:2,collapseSingleKey:a})})}function aS({isRunning:n,instanceVariables:a,datasetExampleInput:l}){const t=m.useMemo(()=>{const i=ma(l)?l:{};return a.filter(r=>i[r]==null)},[l,a]);return n?e(ge,{}):t.length===0?null:e(qi,{children:`Missing input for variable${t.length>1?"s":""}: ${t.join(", ")}`})}function lS({exampleData:n,setDialog:a}){const{span:l,content:t,toolCalls:i,errorMessage:r,experimentRunId:s}=n,d=l!=null,c=s!=null,p=m.useMemo(()=>{if(d||c)return o(J,{children:[c&&o(
|
|
3206
|
-
`),expireMs:1e4}):P({title:"Failed to get output",message:rn.message,expireMs:1e4})}},ee=Fl.requestSubscription(a,U);Ae.push(ee)}return()=>{for(const xe of Ae)xe.dispose()}}else{const Ae=[];for(const xe of Q){const{activeRunId:A}=xe;if(A===null)continue;le({instanceId:xe.id,patch:{experimentId:null},dirty:null});const z={input:Cr({credentials:h,instanceId:xe.id,playgroundStore:K,datasetId:n})},U=D({variables:z,onCompleted:T(xe.id),onError(ee){S(xe.id);const rn=
|
|
3207
|
-
`),expireMs:1e4}):P({title:"Failed to get output",message:ee.message,expireMs:1e4})}});Ae.push(U)}return()=>{for(const xe of Ae)xe.dispose()}}},[h,n,a,D,k,S,P,T,I,K,c]);const{dataset:L}=x.useLazyLoadQuery(Tc,{datasetId:n}),V=m.useRef(null),{data:w,loadNext:$,hasNext:M,isLoadingNext:N}=x.usePaginationFragment(Kc,L),j=m.useMemo(()=>w.examples.edges.map(Q=>{const ie=Q.example,le=ie.revision;return{id:ie.id,input:le.input,output:le.output}}),[w]),q=m.useMemo(()=>l.map((Q,ie)=>{const le=vt(Q,t),Ae=Ss({instance:le,templateFormat:i});return{id:`instance-${Q.id}`,header:()=>o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Ti,{index:ie}),e("span",{children:"Output"})]}),cell:({row:xe})=>e(tS,{instanceId:Q.id,exampleId:xe.original.id,isRunning:k,setDialog:g,instanceVariables:Ae,datasetExampleInput:xe.original.input}),size:500}}),[k,l,i,t]),se=[{header:"input",accessorKey:"input",cell:({row:Q})=>e(tu,{controls:o(
|
|
3205
|
+
`,children:n})}function nS({getValue:n,collapseSingleKey:a}){const l=n();return e(iu,{children:e(Ga,{json:l,space:2,collapseSingleKey:a})})}function aS({isRunning:n,instanceVariables:a,datasetExampleInput:l}){const t=m.useMemo(()=>{const i=ma(l)?l:{};return a.filter(r=>i[r]==null)},[l,a]);return n?e(ge,{}):t.length===0?null:e(qi,{children:`Missing input for variable${t.length>1?"s":""}: ${t.join(", ")}`})}function lS({exampleData:n,setDialog:a}){const{span:l,content:t,toolCalls:i,errorMessage:r,experimentRunId:s}=n,d=l!=null,c=s!=null,p=m.useMemo(()=>{if(d||c)return o(J,{children:[c&&o(Le,{children:[e(E,{size:"S","aria-label":"View experiment run details",leadingVisual:e(_,{svg:e(hl,{})}),onPress:()=>{m.startTransition(()=>{a(e(B1,{runId:s}))})}}),e(gn,{children:"View run details"})]}),d&&e(J,{children:o(Ue,{children:[e(E,{size:"S","aria-label":"View run trace",leadingVisual:e(_,{svg:e(rt,{})})}),e(yn,{size:"fullscreen",variant:"slideover",children:e(au,{traceId:l.context.traceId,projectId:l.project.id,title:"Experiment Run Trace"})})]})})]})},[s,c,d,a,l]);return e(tu,{controls:p,children:e(v,{padding:"size-200",children:o(b,{direction:"column",gap:"size-200",children:[r!=null?e(qi,{children:r}):null,e(C,{children:t}),i!=null?Object.values(i).map(y=>y==null?null:e(lu,{toolCall:y},y.id)):null,d?e(iS,{span:l}):null]})})})}const tS=m.memo(function({isRunning:a,instanceId:l,exampleId:t,setDialog:i,instanceVariables:r,datasetExampleInput:s}){const d=Ma(c=>{var p;return(p=c.exampleResponsesMap[l])==null?void 0:p[t]});return d==null?e(aS,{isRunning:a,instanceVariables:r,datasetExampleInput:s}):e(lS,{exampleData:d,setDialog:i})});function iS({span:n}){return o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(va,{tokenCountTotal:n.tokenCountTotal||0,nodeId:n.id}),e($e,{latencyMs:n.latencyMs||0})]})}function ru({table:n}){return e("tbody",{children:n.getRowModel().rows.map(a=>e("tr",{children:a.getVisibleCells().map(l=>e("td",{style:{padding:0,width:`calc(var(--col-${l.column.id}-size) * 1px)`,wordBreak:"break-all"},children:W(l.column.columnDef.cell,l.getContext())},l.id))},a.id))})}const rS=sn.memo(ru,(n,a)=>n.table.options.data===a.table.options.data);function oS({datasetId:n}){const a=x.useRelayEnvironment(),l=O(Q=>Q.instances),t=O(Q=>Q.allInstanceMessages),i=O(Q=>Q.templateFormat),r=O(Q=>Q.updateInstance),s=Ma(Q=>Q.updateExampleData),d=Ma(Q=>Q.setExampleDataForInstance),c=Ma(Q=>Q.resetExampleData),p=Ma(Q=>Q.appendExampleDataToolCallChunk),y=Ma(Q=>Q.appendExampleDataTextChunk),[u,g]=m.useState(null),[,f]=mn(),k=l.some(Q=>Q.activeRunId!==null),h=Qa(Q=>Q),S=O(Q=>Q.markPlaygroundInstanceComplete),K=Ya(),P=ke(),I=m.useCallback(Q=>ie=>{var Ae;if(ie==null)return;const le=ie.chatCompletionOverDataset;switch(le.__typename){case"ChatCompletionSubscriptionExperiment":r({instanceId:Q,patch:{experimentId:le.experiment.id},dirty:null});break;case"ChatCompletionSubscriptionResult":if(le.datasetExampleId==null)return;s({instanceId:Q,exampleId:le.datasetExampleId,patch:{span:le.span,experimentRunId:(Ae=le.experimentRun)==null?void 0:Ae.id}});break;case"ChatCompletionSubscriptionError":if(le.datasetExampleId==null)return;s({instanceId:Q,exampleId:le.datasetExampleId,patch:{errorMessage:le.message}});break;case"TextChunk":if(le.datasetExampleId==null)return;y({instanceId:Q,exampleId:le.datasetExampleId,textChunk:le.content});break;case"ToolCallChunk":{if(le.datasetExampleId==null)return;p({instanceId:Q,exampleId:le.datasetExampleId,toolCallChunk:le});break}case"%other":return;default:return Pe()}},[y,p,s,r]),[D]=x.useMutation(vc),T=m.useCallback(Q=>(ie,le)=>{if(S(Q),le){P({title:"Chat completion failed",message:le[0].message});return}r({instanceId:Q,patch:{experimentId:ie.chatCompletionOverDataset.experimentId},dirty:null}),d({instanceId:Q,data:Xb(ie.chatCompletionOverDataset)})},[S,P,d,r]);m.useEffect(()=>{if(!k)return;const{instances:Q,streaming:ie,updateInstance:le}=K.getState();if(c(),ie){const Ae=[];for(const xe of Q){const{activeRunId:A}=xe;if(le({instanceId:xe.id,patch:{experimentId:null},dirty:null}),A===null)continue;const z={input:Cr({credentials:h,instanceId:xe.id,playgroundStore:K,datasetId:n})},U={subscription:Cc,variables:z,onNext:I(xe.id),onCompleted:()=>{S(xe.id)},onError:rn=>{S(xe.id);const Lt=Vo(rn);Lt!=null&&Lt.length>0?P({title:"Failed to get output",message:Lt.join(`
|
|
3206
|
+
`),expireMs:1e4}):P({title:"Failed to get output",message:rn.message,expireMs:1e4})}},ee=Fl.requestSubscription(a,U);Ae.push(ee)}return()=>{for(const xe of Ae)xe.dispose()}}else{const Ae=[];for(const xe of Q){const{activeRunId:A}=xe;if(A===null)continue;le({instanceId:xe.id,patch:{experimentId:null},dirty:null});const z={input:Cr({credentials:h,instanceId:xe.id,playgroundStore:K,datasetId:n})},U=D({variables:z,onCompleted:T(xe.id),onError(ee){S(xe.id);const rn=Ie(ee);rn!=null&&rn.length>0?P({title:"Failed to get output",message:rn.join(`
|
|
3207
|
+
`),expireMs:1e4}):P({title:"Failed to get output",message:ee.message,expireMs:1e4})}});Ae.push(U)}return()=>{for(const xe of Ae)xe.dispose()}}},[h,n,a,D,k,S,P,T,I,K,c]);const{dataset:L}=x.useLazyLoadQuery(Tc,{datasetId:n}),V=m.useRef(null),{data:w,loadNext:$,hasNext:M,isLoadingNext:N}=x.usePaginationFragment(Kc,L),j=m.useMemo(()=>w.examples.edges.map(Q=>{const ie=Q.example,le=ie.revision;return{id:ie.id,input:le.input,output:le.output}}),[w]),q=m.useMemo(()=>l.map((Q,ie)=>{const le=vt(Q,t),Ae=Ss({instance:le,templateFormat:i});return{id:`instance-${Q.id}`,header:()=>o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Ti,{index:ie}),e("span",{children:"Output"})]}),cell:({row:xe})=>e(tS,{instanceId:Q.id,exampleId:xe.original.id,isRunning:k,setDialog:g,instanceVariables:Ae,datasetExampleInput:xe.original.input}),size:500}}),[k,l,i,t]),se=[{header:"input",accessorKey:"input",cell:({row:Q})=>e(tu,{controls:o(Le,{children:[e(E,{size:"S","aria-label":"View example details",leadingVisual:e(_,{svg:e(hl,{})}),onPress:()=>{f(ie=>(ie.set("exampleId",Q.original.id),ie))}}),e(gn,{children:"View Example"})]}),children:e(iu,{children:e(Ga,{json:Q.original.input,disableTitle:!0,space:2,collapseSingleKey:!1})})}),size:200},{header:"reference output",accessorKey:"output",cell:Q=>nS({...Q,collapseSingleKey:!0}),size:200},...q],be=Ke({columns:se,data:j,getCoreRowModel:Te(),columnResizeMode:"onChange"}),la=be.getRowModel().rows.length===0,el=m.useCallback(Q=>{if(Q){const{scrollHeight:ie,scrollTop:le,clientHeight:Ae}=Q;ie-le-Ae<300&&!N&&M&&$(Zb)}},[M,N,$]),Ta=sn.useMemo(()=>{const Q=be.getFlatHeaders(),ie={};for(let le=0;le<Q.length;le++){const Ae=Q[le];ie[`--header-${Ae.id}-size`]=Ae.getSize(),ie[`--col-${Ae.column.id}-size`]=Ae.column.getSize()}return ie},[be.getState().columnSizingInfo,be.getState().columnSizing,se.length]);return o("div",{css:F`
|
|
3208
3208
|
flex: 1 1 auto;
|
|
3209
3209
|
overflow: auto;
|
|
3210
3210
|
height: 100%;
|
|
3211
|
-
`,ref:V,onScroll:Q=>el(Q.target),children:[o("table",{css:F(
|
|
3211
|
+
`,ref:V,onScroll:Q=>el(Q.target),children:[o("table",{css:F(He,Mo),style:{...Ta,width:be.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:be.getHeaderGroups().map(Q=>e("tr",{children:Q.headers.map(ie=>o("th",{style:{width:`calc(var(--header-${ie==null?void 0:ie.id}-size) * 1px)`},children:[e("div",{children:W(ie.column.columnDef.header,ie.getContext())}),e("div",{onMouseDown:ie.getResizeHandler(),onTouchStart:ie.getResizeHandler(),className:`resizer ${ie.column.getIsResizing()?"isResizing":""}`})]},ie.id))},Q.id))}),la?e(tn,{}):be.getState().columnSizingInfo.isResizingColumn?e(rS,{table:be}):e(ru,{table:be})]}),e(re,{isDismissable:!0,type:"slideOver",onDismiss:()=>{g(null),f(Q=>(Q.delete(un),Q))},children:u})]})}function sS({datasetId:n}){const a=O(s=>s.instances),l=a.some(s=>s.activeRunId!=null),t=m.useMemo(()=>a.map(s=>s.experimentId).filter(s=>s!=null),[a]),i=ce(),r=x.useLazyLoadQuery(Sc,{datasetId:n});return o(b,{direction:"column",height:"100%",children:[e(v,{flex:"none",backgroundColor:"dark",paddingX:"size-200",paddingY:"size-100",borderBottomColor:"light",borderBottomWidth:"thin",height:50,children:o(b,{justifyContent:"space-between",alignItems:"center",height:"100%",children:[o(b,{gap:"size-100",children:[o(C,{children:[r.dataset.name??"Dataset"," results"]}),r.dataset.exampleCount!=null?o(C,{fontStyle:"italic",color:"text-700",children:[r.dataset.exampleCount," examples"]}):null]}),t.length>0&&o(E,{size:"S",isDisabled:l,leadingVisual:e(_,{svg:l?e(en,{}):e(zo,{})}),onPress:()=>{i(`/datasets/${n}/compare?experimentId=${t.join("&experimentId=")}`)},children:["View Experiment",a.length>1?"s":""]})]})}),e(Q1,{children:e(oS,{datasetId:n})})]})}const $r=30,dS=F`
|
|
3212
3212
|
display: flex;
|
|
3213
3213
|
direction: row;
|
|
3214
3214
|
align-items: center;
|
|
@@ -3229,7 +3229,7 @@ fragment TraceHeaderRootSpanAnnotationsFragment on Span {
|
|
|
3229
3229
|
border-left: none;
|
|
3230
3230
|
height: ${$r}px;
|
|
3231
3231
|
}
|
|
3232
|
-
`;function cS(){const[n,a]=
|
|
3232
|
+
`;function cS(){const[n,a]=mn(),l=n.get("datasetId")??"";return o("div",{css:dS,children:[e(wo,{size:"S",placeholder:"Test over a dataset",selectedKey:l,onSelectionChange:t=>{if(l!==null&&t===l){a(i=>(i.delete("datasetId"),i));return}a(i=>(i.set("datasetId",String(t)),i))}}),e(E,{size:"S",leadingVisual:e(_,{svg:e(No,{})}),onPress:()=>{a(t=>(t.delete("datasetId"),t))}})]})}const uS=()=>{const n=O(d=>d.input),a=O(d=>d.instances),l=O(d=>d.allInstanceMessages),t=O(d=>d.templateFormat),i=m.useMemo(()=>a.map(d=>vt(d,l)),[a,l]),{variableKeys:r,variablesMap:s}=m.useMemo(()=>vs({instances:i,templateFormat:t,input:n}),[n,i,t]);return{variableKeys:r,variablesMap:s}},mS={lineNumbers:!1,highlightActiveLine:!1,foldGutter:!1,highlightActiveLineGutter:!1,bracketMatching:!1,syntaxHighlighting:!1,defaultKeymap:!1},gS=[is.lineWrapping,Ai.of([...kh.filter(n=>n.key!=="Mod-Enter")])],pS=({label:n,defaultValue:a,onChange:l})=>{const{theme:t}=Xn(),i=m.useRef(a),[r,s]=m.useState(0),[d,c]=m.useState(()=>a);return m.useEffect(()=>{a==null&&(c(""),s(y=>y+1)),i.current=a},[a]),m.useEffect(()=>{c(i.current),s(y=>y+1)},[n]),e(ba,{label:n,children:e(Ze,{width:"100%",children:e(Ka,{theme:t==="light"?Ca:Fa,basicSetup:mS,value:d,extensions:gS,onChange:l},r)})})};function yS(){const{variableKeys:n,variablesMap:a}=uS(),l=O(i=>i.setVariableValue),t=O(i=>i.templateFormat);if(n.length===0){let i="";switch(t){case fn.FString:{i="{input name}";break}case fn.Mustache:{i="{{input name}}";break}case fn.NONE:return null;default:Pe()}return e(v,{padding:"size-100",children:e(b,{direction:"column",justifyContent:"center",alignItems:"center",children:o(C,{color:"text-700",children:["Add variable inputs to your prompt using"," ",e(C,{color:"text-900",children:i})," within your prompt template."]})})})}return e(b,{direction:"column",gap:"size-200",width:"100%",children:n.map((i,r)=>e(pS,{label:i,defaultValue:a[i]??"",onChange:s=>l(i,s)},r))})}const ou=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"ChatCompletionMutationPayload",kind:"LinkedField",name:"chatCompletion",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"content",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"errorMessage",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"span",plural:!1,selections:[a],storageKey:null},{alias:null,args:null,concreteType:"ChatCompletionToolCall",kind:"LinkedField",name:"toolCalls",plural:!0,selections:[a,{alias:null,args:null,concreteType:"ChatCompletionFunctionCall",kind:"LinkedField",name:"function",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"PlaygroundOutputMutation",selections:l,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"PlaygroundOutputMutation",selections:l},params:{cacheID:"9dc63d3e40081b276c1cbd5f21405c6f",id:null,metadata:{},name:"PlaygroundOutputMutation",operationKind:"mutation",text:`mutation PlaygroundOutputMutation(
|
|
3233
3233
|
$input: ChatCompletionInput!
|
|
3234
3234
|
) {
|
|
3235
3235
|
chatCompletion(input: $input) {
|
|
@@ -3273,7 +3273,7 @@ fragment TraceHeaderRootSpanAnnotationsFragment on Span {
|
|
|
3273
3273
|
}
|
|
3274
3274
|
}
|
|
3275
3275
|
}
|
|
3276
|
-
`}}}();su.hash="bb5936a61a0e99dbb4a298a6e552a01c";const fS=({instance:n,outputContent:a,toolCalls:l,cleanupOutput:t})=>{const i=n.id,r=O(s=>s.addMessage);return o(
|
|
3276
|
+
`}}}();su.hash="bb5936a61a0e99dbb4a298a6e552a01c";const fS=({instance:n,outputContent:a,toolCalls:l,cleanupOutput:t})=>{const i=n.id,r=O(s=>s.addMessage);return o(Le,{delay:500,offset:10,children:[e(E,{size:"S",leadingVisual:e(_,{svg:e(Nn,{})}),"aria-label":"Move the output message to the end of the prompt",onPress:()=>{if(n.template.__type!=="chat")return;const s=Array.isArray(a)?a:a?[{id:oa(),role:ia("ai"),content:a}]:[];l.length>0&&s.push({id:oa(),role:ia("ai"),toolCalls:$o({provider:n.model.provider,toolCalls:l.map(d=>{var c;return{...d,function:{...d.function,arguments:((c=Qe(d.function.arguments))==null?void 0:c.json)??d.function.arguments}}})})}),r({playgroundInstanceId:i,messages:s}),t()},children:"Prompt"}),e(gn,{children:"Move the output message to the end of the prompt"})]})},du=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"spanId"}],a=[{kind:"Variable",name:"id",variableName:"spanId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[l],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null}],type:"Span",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"RunMetadataFooterQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"RunMetadataFooterQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,t],storageKey:null}]},params:{cacheID:"24fe0e0ac8fe3f88cbbce31e0dd43e12",id:null,metadata:{},name:"RunMetadataFooterQuery",operationKind:"query",text:`query RunMetadataFooterQuery(
|
|
3277
3277
|
$spanId: ID!
|
|
3278
3278
|
) {
|
|
3279
3279
|
span: node(id: $spanId) {
|
|
@@ -3293,9 +3293,9 @@ fragment TraceHeaderRootSpanAnnotationsFragment on Span {
|
|
|
3293
3293
|
}
|
|
3294
3294
|
}
|
|
3295
3295
|
}
|
|
3296
|
-
`}}}();du.hash="f511626560567f113e6b977bfea1efd3";function hS({spanId:n}){const[,a]=
|
|
3297
|
-
`)}):P({title:"Failed to get output",message:se.message})}};return Fl.requestSubscription(u,j).dispose}return h({variables:{input:M},onCompleted:w,onError(j){k(!1),y(n.playgroundInstanceId);const q=
|
|
3298
|
-
`)}):P({title:"Failed to get output",message:j.message})}}).dispose},[$,i,u,h,S,a,y,P,w,V,g,n.playgroundInstanceId,t,d]),e(B,{title:e(kS,{index:r,title:"Output"}),extra:I!=null||(T==null?void 0:T.length)>0?e(fS,{outputContent:I,toolCalls:T,instance:s,cleanupOutput:$}):null,titleSeparator:!0,collapsible:!0,variant:"compact",bodyStyle:{padding:0},children:f?e(v,{padding:"size-200",children:e(ge,{message:"Running..."})}):c?e(v,{padding:"size-200",children:e(qi,{children:c.message})}):o(J,{children:[e(v,{padding:"size-200",children:e(vn,{children:e(SS,{content:I,partialToolCalls:T})})}),e(m.Suspense,{children:s.spanId?e(hS,{spanId:s.spanId}):null})]})})}function CS(){return m.useMemo(()=>window.navigator.userAgent.toLowerCase().includes("mac")?"Cmd":"Ctrl",[])}function FS(){const n=CS(),a=O(r=>r.runPlaygroundInstances),l=O(r=>r.cancelPlaygroundInstances),t=O(r=>r.instances.some(s=>s.activeRunId!=null)),i=m.useCallback(()=>{t?l():a()},[t,l,a]);return ua("mod+enter",r=>{r.preventDefault(),r.stopPropagation(),i()},{enableOnFormTags:!0,enableOnContentEditable:!0,preventDefault:!0}),e(E,{variant:"primary",leadingVisual:e(_,{svg:t?e(en,{}):e(wa,{})}),size:"S",onPress:()=>{i()},trailingVisual:o(Ro,{children:[e(Zt,{children:n}),e("span",{"aria-hidden":"true",children:n==="Cmd"?"⌘":"Ctrl"}),e(Zt,{children:"enter"}),e("span",{"aria-hidden":"true",children:"⏎"})]}),children:t?"Cancel":"Run"})}function KS(){const n=O(i=>i.streaming),a=O(i=>i.setStreaming),l=
|
|
3296
|
+
`}}}();du.hash="f511626560567f113e6b977bfea1efd3";function hS({spanId:n}){const[,a]=mn(),l=x.useLazyLoadQuery(du,{spanId:n},{fetchPolicy:"store-and-network"});if(!l.span||!l.span.trace||!l.span.trace.project)return null;const{trace:t}=l.span;return e(v,{borderTopColor:"light",borderTopWidth:"thin",paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",children:o(b,{direction:"row",gap:"size-200",justifyContent:"space-between",children:[o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(va,{tokenCountTotal:l.span.tokenCountTotal||0,nodeId:l.span.id}),e($e,{latencyMs:l.span.latencyMs||0})]}),o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[o(Ue,{children:[e(E,{size:"S",leadingVisual:e(_,{svg:e(Sa,{})}),children:"Annotate"}),e(yn,{variant:"slideover",size:"S",isDismissable:!0,shouldCloseOnInteractOutside:()=>!0,children:e(jo,{spanNodeId:n,projectId:t.project.id})})]}),o(Ue,{onOpenChange:i=>{i||a(r=>(r.delete(un),r))},children:[e(E,{size:"S",leadingVisual:e(_,{svg:e(rt,{})}),children:"View Trace"}),e(yn,{variant:"slideover",size:"fullscreen",isDismissable:!0,shouldCloseOnInteractOutside:()=>!0,children:e(m.Suspense,{fallback:e(ge,{}),children:e(au,{traceId:t.traceId,projectId:t.project.id,title:"Playground Trace"})})})]})]})]})})}function kS({index:n,title:a}){return o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Ti,{index:n}),e("span",{children:a})]})}const bS=n=>ma(n)&&(typeof n.id=="string"||typeof n.id=="number")?n.id:JSON.stringify(n);function jr({message:n}){const{role:a,content:l,toolCalls:t}=n,i=Dl(a);return o(B,{title:a,...i,variant:"compact",extra:e(Vn,{}),bodyStyle:{padding:0},children:[l!=null&&!Array.isArray(l)&&e(Da,{children:l}),t&&t.length>0?t.map(r=>e(lu,{toolCall:r},bS(r))):null]})}function SS({content:n,partialToolCalls:a}){return i0(n)?n.map((l,t)=>e(jr,{message:l},t)):typeof n=="string"||a.length>0?e(jr,{message:{id:oa(),content:n,role:"ai",toolCalls:a}}):"click run to see output"}function vS(n){const a=n.playgroundInstanceId,l=O(M=>M.instances),t=O(M=>M.streaming),i=Qa(M=>M),r=O(M=>M.instances.findIndex(N=>N.id===a)),s=l.find(M=>M.id===a),d=O(M=>M.updateInstance),[c,p]=m.useState(null),y=O(M=>M.markPlaygroundInstanceComplete),u=x.useRelayEnvironment(),g=Ya();if(!s)throw new Error(`No instance found for id ${a}`);if(s.template.__type!=="chat")throw new Error("We only support chat templates for now");const[f,k]=m.useState(!1),[h]=x.useMutation(ou),S=(s==null?void 0:s.activeRunId)!=null,K=ke(),P=m.useCallback(({title:M,message:N,...j})=>{p({title:M,message:N}),K({title:M,message:N,...j})},[K]),[I,D]=m.useState(s.output),[T,L]=m.useState([]),V=m.useCallback(({chatCompletion:M})=>{if(k(!1),M.__typename==="TextChunk"){const N=M.content;D(j=>j!=null?j+N:N);return}else if(M.__typename==="ToolCallChunk"){L(N=>{let j=!1;const q=N.map(se=>se.id===M.id?(j=!0,{...se,function:{...se.function,arguments:se.function.arguments+M.function.arguments}}):se);return j||q.push({id:M.id,function:{name:M.function.name,arguments:M.function.arguments}}),q});return}if(M.__typename==="ChatCompletionSubscriptionResult"&&M.span!=null){d({instanceId:a,patch:{spanId:M.span.id},dirty:null});return}M.__typename==="ChatCompletionSubscriptionError"&&(y(n.playgroundInstanceId),M.message!=null&&P({title:"Chat completion failed",message:M.message}))},[a,y,P,n.playgroundInstanceId,d]),w=m.useCallback((M,N)=>{if(k(!1),y(n.playgroundInstanceId),d({instanceId:a,patch:{spanId:M.chatCompletion.span.id},dirty:null}),N){P({title:"Chat completion failed",message:N[0].message});return}if(M.chatCompletion.errorMessage!=null){P({title:"Chat completion failed",message:M.chatCompletion.errorMessage});return}D(M.chatCompletion.content??void 0),L(M.chatCompletion.toolCalls)},[a,y,P,n.playgroundInstanceId,d]),$=m.useCallback(()=>{D(void 0),L([]),p(null),d({instanceId:a,patch:{spanId:null},dirty:null})},[a,d]);return m.useEffect(()=>{if(!S){k(!1);return}k(!0),$();const M=g0({playgroundStore:g,instanceId:a,credentials:i});if(t){const j={subscription:su,variables:{input:M},onNext:se=>{se&&V(se)},onCompleted:()=>{k(!1),y(n.playgroundInstanceId)},onError:se=>{k(!1),y(n.playgroundInstanceId);const be=Vo(se);be!=null&&be.length>0?P({title:"Failed to get output",message:be.join(`
|
|
3297
|
+
`)}):P({title:"Failed to get output",message:se.message})}};return Fl.requestSubscription(u,j).dispose}return h({variables:{input:M},onCompleted:w,onError(j){k(!1),y(n.playgroundInstanceId);const q=Ie(j);q!=null&&q.length>0?P({title:"Failed to get output",message:q.join(`
|
|
3298
|
+
`)}):P({title:"Failed to get output",message:j.message})}}).dispose},[$,i,u,h,S,a,y,P,w,V,g,n.playgroundInstanceId,t,d]),e(B,{title:e(kS,{index:r,title:"Output"}),extra:I!=null||(T==null?void 0:T.length)>0?e(fS,{outputContent:I,toolCalls:T,instance:s,cleanupOutput:$}):null,titleSeparator:!0,collapsible:!0,variant:"compact",bodyStyle:{padding:0},children:f?e(v,{padding:"size-200",children:e(ge,{message:"Running..."})}):c?e(v,{padding:"size-200",children:e(qi,{children:c.message})}):o(J,{children:[e(v,{padding:"size-200",children:e(vn,{children:e(SS,{content:I,partialToolCalls:T})})}),e(m.Suspense,{children:s.spanId?e(hS,{spanId:s.spanId}):null})]})})}function CS(){return m.useMemo(()=>window.navigator.userAgent.toLowerCase().includes("mac")?"Cmd":"Ctrl",[])}function FS(){const n=CS(),a=O(r=>r.runPlaygroundInstances),l=O(r=>r.cancelPlaygroundInstances),t=O(r=>r.instances.some(s=>s.activeRunId!=null)),i=m.useCallback(()=>{t?l():a()},[t,l,a]);return ua("mod+enter",r=>{r.preventDefault(),r.stopPropagation(),i()},{enableOnFormTags:!0,enableOnContentEditable:!0,preventDefault:!0}),e(E,{variant:"primary",leadingVisual:e(_,{svg:t?e(en,{}):e(wa,{})}),size:"S",onPress:()=>{i()},trailingVisual:o(Ro,{children:[e(Zt,{children:n}),e("span",{"aria-hidden":"true",children:n==="Cmd"?"⌘":"Ctrl"}),e(Zt,{children:"enter"}),e("span",{"aria-hidden":"true",children:"⏎"})]}),children:t?"Cancel":"Run"})}function KS(){const n=O(i=>i.streaming),a=O(i=>i.setStreaming),l=cn(i=>i.setPlaygroundStreamingEnabled),t=O(i=>i.instances.some(r=>r.activeRunId!=null));return e(ha,{labelPlacement:"start",isSelected:n,onChange:()=>{a(!n),l(!n)},isDisabled:t,children:"Stream"})}const cu=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"Prompt",kind:"LinkedField",name:"createChatPromptVersion",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"UpsertPromptFromTemplateDialogUpdateMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"UpsertPromptFromTemplateDialogUpdateMutation",selections:a},params:{cacheID:"5560d38314208ef482b716e9817358fe",id:null,metadata:{},name:"UpsertPromptFromTemplateDialogUpdateMutation",operationKind:"mutation",text:`mutation UpsertPromptFromTemplateDialogUpdateMutation(
|
|
3299
3299
|
$input: CreateChatPromptVersionInput!
|
|
3300
3300
|
) {
|
|
3301
3301
|
createChatPromptVersion(input: $input) {
|
|
@@ -3332,7 +3332,7 @@ fragment TraceHeaderRootSpanAnnotationsFragment on Span {
|
|
|
3332
3332
|
}
|
|
3333
3333
|
}
|
|
3334
3334
|
}
|
|
3335
|
-
`}}}();gu.hash="42af63a75d1f1b2184518e94395121cd";function pu({onChange:n,container:a,promptId:l,...t}){const r=x.useLazyLoadQuery(gu,{},{fetchPolicy:"store-and-network",fetchKey:l??void 0}).prompts.edges,s=m.useMemo(()=>r.map(d=>d.prompt),[r]);return e(xi,{size:"M","data-testid":"prompt-picker",selectedKey:l??null,"aria-label":"prompt picker",width:"100%",menuTrigger:"focus",stopPropagation:!0,container:a,defaultItems:s,placeholder:"Select a prompt...",renderEmptyState:()=>e("div",{children:"No prompts found"}),onSelectionChange:d=>{if(!(typeof d!="string"&&d!=null)){if(d===l){n(null);return}n(d)}},...t,children:d=>e(Pi,{textValue:d.name,id:d.id,children:d.name},d.id)})}const TS=/^[a-z0-9]([_a-z0-9-]*[a-z0-9])?$/,yu={value:TS,message:"Invalid identifier. Must be alphanumeric and with dashes or underscores"};function PS({onCreate:n,onUpdate:a,isSubmitting:l=!1,defaultSelectedPromptId:t}){var I,D,T,L;const i=m.useRef(null),r=x.useLazyLoadQuery(mu,{},{fetchPolicy:"network-only"}),[s,d]=m.useState(t??null),c=(D=(I=r==null?void 0:r.prompts)==null?void 0:I.edges)==null?void 0:D.find(V=>{var w;return((w=V==null?void 0:V.prompt)==null?void 0:w.id)===s}),[p,y]=m.useState(((T=c==null?void 0:c.prompt)==null?void 0:T.name)??""),u=c?"update":"create",g=u==="create"?"Create Prompt":"Update Prompt",{control:f,handleSubmit:k,formState:{isDirty:h,isValid:S},trigger:K}=Ve({values:{promptId:s??void 0,name:u==="update"&&c?(L=c==null?void 0:c.prompt)==null?void 0:L.name:p},defaultValues:{description:""},reValidateMode:"onChange",resetOptions:{keepDefaultValues:!0}}),P=m.useCallback(V=>{u==="create"?n(V):a(V)},[n,a,u]);return o(b,{direction:"column",gap:"size-100",ref:i,children:[e(v,{paddingX:"size-200",paddingTop:"size-200",children:e(H,{name:"name",control:f,rules:{required:{message:"Prompt is required",value:!0},pattern:yu},render:({field:{onBlur:V,onChange:w},fieldState:$})=>{var M;return e(pu,{label:"Prompt",description:"The prompt to update, or prompt name to create",placeholder:"Select or enter new prompt name",isRequired:!0,onBlur:V,defaultInputValue:p,onInputChange:N=>{y(N),w(N),K("name")},container:i.current??void 0,errorMessage:(M=$.error)==null?void 0:M.message,allowsCustomValue:!0,onChange:N=>{w(N),d(N)},promptId:s})}})}),o(Ye,{onSubmit:k(P),children:[e(v,{paddingX:"size-200",paddingBottom:"size-200",children:e(H,{name:"description",control:f,render:({field:{onChange:V,onBlur:w,value:$},fieldState:{invalid:M,error:N}})=>o(X,{isInvalid:M,onChange:V,onBlur:w,value:$,size:"S",children:[e(G,{children:u==="create"?"Prompt Description":"Change Description"}),e(fa,{}),N?e(Se,{children:N.message}):e(C,{slot:"description",children:u==="create"?"A description of your prompt (optional)":"A description of your changes to the prompt (optional)"})]})})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:h?"primary":"default",size:"S",isDisabled:l||!S,type:"submit",children:g})})})]})]})}const Or=(n,a)=>{const l=a.getState(),t=l.allInstanceMessages,i=l.instances.find(c=>c.id===n);if(!i)throw new Error(`Instance ${n} not found`);const r=vt(i,t),s=F1(r);if(!s)throw new Error(`Could not convert instance ${n} to prompt`);const d=l.templateFormat;return{promptInput:s,templateFormat:d}},xS=({instanceId:n,setDialog:a,selectedPromptId:l})=>{const t=ce(),i=me(),r=ke(),s=Ya(),[d,c]=x.useMutation(uu),[p,y]=x.useMutation(cu),u=m.useCallback((k,h)=>{const S=s.getState();S.instances.find(P=>P.id===n)&&S.updateInstance({instanceId:n,patch:{prompt:{id:k,name:h}},dirty:!1})},[s,n]),g=m.useCallback(k=>{const{promptInput:h,templateFormat:S}=Or(n,s);d({variables:{input:{name:k.name,description:k.description,promptVersion:{...h,templateFormat:S}}},onCompleted:K=>{i({title:"Prompt successfully created",action:{text:"View Prompt",onClick:()=>{t(`/prompts/${K.createChatPrompt.id}`)}}}),u(K.createChatPrompt.id,K.createChatPrompt.name),a(null)},onError:K=>{const P=
|
|
3335
|
+
`}}}();gu.hash="42af63a75d1f1b2184518e94395121cd";function pu({onChange:n,container:a,promptId:l,...t}){const r=x.useLazyLoadQuery(gu,{},{fetchPolicy:"store-and-network",fetchKey:l??void 0}).prompts.edges,s=m.useMemo(()=>r.map(d=>d.prompt),[r]);return e(xi,{size:"M","data-testid":"prompt-picker",selectedKey:l??null,"aria-label":"prompt picker",width:"100%",menuTrigger:"focus",stopPropagation:!0,container:a,defaultItems:s,placeholder:"Select a prompt...",renderEmptyState:()=>e("div",{children:"No prompts found"}),onSelectionChange:d=>{if(!(typeof d!="string"&&d!=null)){if(d===l){n(null);return}n(d)}},...t,children:d=>e(Pi,{textValue:d.name,id:d.id,children:d.name},d.id)})}const TS=/^[a-z0-9]([_a-z0-9-]*[a-z0-9])?$/,yu={value:TS,message:"Invalid identifier. Must be alphanumeric and with dashes or underscores"};function PS({onCreate:n,onUpdate:a,isSubmitting:l=!1,defaultSelectedPromptId:t}){var I,D,T,L;const i=m.useRef(null),r=x.useLazyLoadQuery(mu,{},{fetchPolicy:"network-only"}),[s,d]=m.useState(t??null),c=(D=(I=r==null?void 0:r.prompts)==null?void 0:I.edges)==null?void 0:D.find(V=>{var w;return((w=V==null?void 0:V.prompt)==null?void 0:w.id)===s}),[p,y]=m.useState(((T=c==null?void 0:c.prompt)==null?void 0:T.name)??""),u=c?"update":"create",g=u==="create"?"Create Prompt":"Update Prompt",{control:f,handleSubmit:k,formState:{isDirty:h,isValid:S},trigger:K}=Ve({values:{promptId:s??void 0,name:u==="update"&&c?(L=c==null?void 0:c.prompt)==null?void 0:L.name:p},defaultValues:{description:""},reValidateMode:"onChange",resetOptions:{keepDefaultValues:!0}}),P=m.useCallback(V=>{u==="create"?n(V):a(V)},[n,a,u]);return o(b,{direction:"column",gap:"size-100",ref:i,children:[e(v,{paddingX:"size-200",paddingTop:"size-200",children:e(H,{name:"name",control:f,rules:{required:{message:"Prompt is required",value:!0},pattern:yu},render:({field:{onBlur:V,onChange:w},fieldState:$})=>{var M;return e(pu,{label:"Prompt",description:"The prompt to update, or prompt name to create",placeholder:"Select or enter new prompt name",isRequired:!0,onBlur:V,defaultInputValue:p,onInputChange:N=>{y(N),w(N),K("name")},container:i.current??void 0,errorMessage:(M=$.error)==null?void 0:M.message,allowsCustomValue:!0,onChange:N=>{w(N),d(N)},promptId:s})}})}),o(Ye,{onSubmit:k(P),children:[e(v,{paddingX:"size-200",paddingBottom:"size-200",children:e(H,{name:"description",control:f,render:({field:{onChange:V,onBlur:w,value:$},fieldState:{invalid:M,error:N}})=>o(X,{isInvalid:M,onChange:V,onBlur:w,value:$,size:"S",children:[e(G,{children:u==="create"?"Prompt Description":"Change Description"}),e(fa,{}),N?e(Se,{children:N.message}):e(C,{slot:"description",children:u==="create"?"A description of your prompt (optional)":"A description of your changes to the prompt (optional)"})]})})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:h?"primary":"default",size:"S",isDisabled:l||!S,type:"submit",children:g})})})]})]})}const Or=(n,a)=>{const l=a.getState(),t=l.allInstanceMessages,i=l.instances.find(c=>c.id===n);if(!i)throw new Error(`Instance ${n} not found`);const r=vt(i,t),s=F1(r);if(!s)throw new Error(`Could not convert instance ${n} to prompt`);const d=l.templateFormat;return{promptInput:s,templateFormat:d}},xS=({instanceId:n,setDialog:a,selectedPromptId:l})=>{const t=ce(),i=me(),r=ke(),s=Ya(),[d,c]=x.useMutation(uu),[p,y]=x.useMutation(cu),u=m.useCallback((k,h)=>{const S=s.getState();S.instances.find(P=>P.id===n)&&S.updateInstance({instanceId:n,patch:{prompt:{id:k,name:h}},dirty:!1})},[s,n]),g=m.useCallback(k=>{const{promptInput:h,templateFormat:S}=Or(n,s);d({variables:{input:{name:k.name,description:k.description,promptVersion:{...h,templateFormat:S}}},onCompleted:K=>{i({title:"Prompt successfully created",action:{text:"View Prompt",onClick:()=>{t(`/prompts/${K.createChatPrompt.id}`)}}}),u(K.createChatPrompt.id,K.createChatPrompt.name),a(null)},onError:K=>{const P=Ie(K);r({title:"Error creating prompt",message:P==null?void 0:P[0]}),a(null)}})},[d,n,t,r,i,u,a,s]),f=m.useCallback(k=>{if(!k.promptId)throw new Error("Prompt ID is required");const{promptInput:h,templateFormat:S}=Or(n,s);p({variables:{input:{promptId:k.promptId,promptVersion:{...h,templateFormat:S,description:k.description}}},onCompleted:K=>{i({title:"Prompt successfully updated",action:{text:"View Prompt",onClick:()=>{t(`/prompts/${K.createChatPromptVersion.id}`)}}}),u(K.createChatPromptVersion.id,K.createChatPromptVersion.name),a(null)},onError:K=>{const P=Ie(K);r({title:"Error updating prompt",message:P==null?void 0:P[0]}),a(null)}})},[n,t,r,i,a,s,p,u]);return e(te,{title:"Create Prompt from Template",children:e(m.Suspense,{fallback:e(ge,{}),children:e(PS,{onCreate:g,onUpdate:f,isSubmitting:c||y,defaultSelectedPromptId:l})})})},fu={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ModelConfigButtonDialogQuery",selections:[{args:null,kind:"FragmentSpread",name:"ModelProviderPickerFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"ModelConfigButtonDialogQuery",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null}],storageKey:null}]},params:{cacheID:"64ad561d3ca07bdded6af274c73eb18a",id:null,metadata:{},name:"ModelConfigButtonDialogQuery",operationKind:"query",text:`query ModelConfigButtonDialogQuery {
|
|
3336
3336
|
...ModelProviderPickerFragment
|
|
3337
3337
|
}
|
|
3338
3338
|
|
|
@@ -3348,14 +3348,14 @@ fragment ModelProviderPickerFragment on Query {
|
|
|
3348
3348
|
& .ac-view {
|
|
3349
3349
|
width: 100%;
|
|
3350
3350
|
}
|
|
3351
|
-
`,children:e(ba,{label:l,errorMessage:t,validationState:t?"invalid":void 0,children:e(
|
|
3351
|
+
`,children:e(ba,{label:l,errorMessage:t,validationState:t?"invalid":void 0,children:e(Ze,{children:e(on,{value:i,onChange:s,optionalLint:!0})})})})}const _S=({field:n,value:a,onChange:l,errors:t,control:i})=>{var u;const r=n.invocationName;if(!r)throw new Error("Invocation name is required");const s=(u=t[r])==null?void 0:u.message,d=n.required?`${n.label||r} is required`:void 0,c=n.minValue!=null?`${n.label||r} must be at least ${n.minValue}`:void 0,p=n.maxValue!=null?`${n.label||r} must be at most ${n.maxValue}`:void 0;if(n.canonicalName==="ANTHROPIC_EXTENDED_THINKING")return e(DS,{onChange:l,value:a});const{__typename:y}=n;switch(y){case"InvocationParameterBase":return null;case"BoundedFloatInvocationParameter":return typeof a!="number"&&a!==void 0?null:e(af,{label:n.label,defaultValue:a,step:.1,minValue:n.minValue,maxValue:n.maxValue,onChange:g=>l(g),children:e(nf,{})});case"FloatInvocationParameter":case"IntInvocationParameter":return e(H,{control:i,name:r,rules:{required:d,min:c,max:p},render:({field:{onBlur:g}})=>o(sa,{isRequired:n.required,value:Number(a),onBlur:g,onChange:f=>{l(f)},children:[e(G,{children:n.label}),e(Z,{}),s?e(Se,{children:s}):null]})});case"StringListInvocationParameter":return!Array.isArray(a)&&a!==void 0?null:e(H,{control:i,name:r,rules:{required:d},render:({field:{onBlur:g}})=>o(X,{isRequired:n.required,defaultValue:(a==null?void 0:a.join(", "))??"",onBlur:g,onChange:f=>{if(f===""){l(void 0);return}l(f.split(/, */g))},children:[e(G,{children:n.label}),e(Z,{}),s?e(Se,{children:s}):e(C,{slot:"description",children:"A comma separated list of strings"})]})});case"StringInvocationParameter":return e(H,{control:i,name:r,rules:{required:d},render:({field:{onBlur:g}})=>o(X,{isRequired:n.required,defaultValue:(a==null?void 0:a.toString())||"",type:"text",onBlur:g,onChange:f=>{if(f===""){l(void 0);return}l(f)},children:[e(G,{children:n.label}),e(Z,{}),s?e(Se,{children:s}):null]})});case"BooleanInvocationParameter":return e(ha,{onChange:l,defaultSelected:!!a,children:n.label});case"JSONInvocationParameter":return e(H,{control:i,name:r,rules:{required:d},render:()=>e(LS,{defaultValue:a,onChange:l,label:n.label??n.invocationName??"",errorMessage:s})});default:return null}},AS=(n,a)=>{if(n.invocationInputField===void 0)throw new Error("Invocation input field is required");return a[Xa(n.invocationInputField)]},wS=(n,a)=>{if(n.invocationName===void 0)throw new Error("Invocation name is required");if(n.invocationInputField===void 0)throw new Error("Invocation input field is required");return{invocationName:n.invocationName,canonicalName:n.canonicalName,[Xa(n.invocationInputField)]:a}},RS=({instanceId:n})=>{const a=O(f=>f.instances.find(k=>k.id===n));if(!a)throw new Error("Instance not found");const{model:l}=a,t=O(f=>f.upsertInvocationParameterInput),i=O(f=>f.deleteInvocationParameterInput),r=a.model.supportedInvocationParameters,s=a.model.invocationParameters,d=m.useCallback((f,k)=>{if(!f.invocationName)throw new Error("Invocation name is required");k===void 0?i({instanceId:n,invocationParameterInputInvocationName:f.invocationName}):t({instanceId:n,invocationParameterInput:wS(f,k)})},[n,t,i]),c=m.useMemo(()=>r.filter(f=>!(f.canonicalName!=null&&Lh.includes(f.canonicalName))).reduce((f,k)=>{const h=s.find(K=>ga(K,k)),S=h?AS(k,h):void 0;return{...f,[k.invocationName]:S??null}},{}),[s,r]),p=Ve({values:c,mode:"onBlur",delayError:0,shouldFocusError:!1,resetOptions:{keepErrors:!0}}),y=p.trigger,u=m.useMemo(()=>Tn.debounce(y,250),[y]);return m.useEffect(()=>{u()},[c,u]),l.provider!=="AZURE_OPENAI"&&l.modelName===null?null:Object.entries(c).map(([f,k])=>{const h=r.find(K=>K.invocationName===f);if(!h)return null;const S=`${l.provider??"model"}-${h.invocationName}`;return e(_S,{field:h,value:k,onChange:K=>d(h,K),control:p.control,errors:p.formState.errors},S)})},Wi=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"providerKey"}],a=[{alias:null,args:[{fields:[{kind:"Variable",name:"providerKey",variableName:"providerKey"}],kind:"ObjectValue",name:"input"}],concreteType:"GenerativeModel",kind:"LinkedField",name:"models",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ModelComboBoxQuery",selections:a,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ModelComboBoxQuery",selections:a},params:{cacheID:"a3417a3b2ae9ad193a5fd68335cfd660",id:null,metadata:{},name:"ModelComboBoxQuery",operationKind:"query",text:`query ModelComboBoxQuery(
|
|
3352
3352
|
$providerKey: GenerativeProviderKey!
|
|
3353
3353
|
) {
|
|
3354
3354
|
models(input: {providerKey: $providerKey}) {
|
|
3355
3355
|
name
|
|
3356
3356
|
}
|
|
3357
3357
|
}
|
|
3358
|
-
`}}}();Wi.hash="fc5563c6dca10fdeda807cd7061e275a";function ES({onChange:n,container:a,modelName:l,queryReference:t,...i}){const r=x.usePreloadedQuery(Wi,t),s=m.useMemo(()=>r.models.map(u=>({name:u.name,id:u.name})),[r.models]),[d,c]=m.useState({selectedKey:l??null,inputValue:l??""}),p=u=>{if(typeof u=="string"){const g=s.find(f=>f.id===u);(g==null?void 0:g.name)!=null&&n(g.name)}},y=u=>{c(g=>({inputValue:u,selectedKey:g.selectedKey}))};return m.useEffect(()=>{c({selectedKey:l??null,inputValue:l??""})},[l]),e(xi,{size:"L",label:"Model",isRequired:!0,"data-testid":"model-picker",selectedKey:d.selectedKey,"aria-label":"model picker",onInputChange:y,inputValue:d.inputValue,onSelectionChange:p,width:"100%",allowsCustomValue:!0,onBlur:()=>{d.inputValue!==""&&n(d.inputValue)},onKeyUp:u=>{u.key==="Enter"&&n(d.inputValue)},menuTrigger:"focus",container:a,description:"Choose a model from the list, or enter a custom model name",defaultItems:s,...i,children:u=>e(Pi,{textValue:u.name,id:u.id,children:u.name},u.id)})}function hu(n){const[a,l,t]=x.useQueryLoader(Wi);return m.useEffect(()=>(l({providerKey:n.provider}),()=>t()),[t,l,n.provider]),a!=null?e(ES,{queryReference:a,...n}):null}const ku={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ModelProviderPickerFragment",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};ku.hash="1d4ba7f81a958c9a17bd45dce0456ddb";function MS({onChange:n,query:a,...l}){var d,c;const t=x.useFragment(ku,a),i=t.modelProviders.filter(p=>p.dependenciesInstalled),r=i.length!==t.modelProviders.length,s=l.provider&&!i.some(p=>p.key===l.provider);return o(b,{direction:"row",gap:"size-100",children:[e(si,{label:"Provider","data-testid":"model-provider-picker",selectedKey:l.provider??void 0,"aria-label":"Model Provider",placeholder:"Select a provider",onSelectionChange:p=>{const y=p;Lc(y)&&n(y)},width:"100%",...l,children:t.modelProviders.map(p=>e(ue,{children:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(et,{provider:p.key,height:16}),p.name]})},p.key))}),s?o(
|
|
3358
|
+
`}}}();Wi.hash="fc5563c6dca10fdeda807cd7061e275a";function ES({onChange:n,container:a,modelName:l,queryReference:t,...i}){const r=x.usePreloadedQuery(Wi,t),s=m.useMemo(()=>r.models.map(u=>({name:u.name,id:u.name})),[r.models]),[d,c]=m.useState({selectedKey:l??null,inputValue:l??""}),p=u=>{if(typeof u=="string"){const g=s.find(f=>f.id===u);(g==null?void 0:g.name)!=null&&n(g.name)}},y=u=>{c(g=>({inputValue:u,selectedKey:g.selectedKey}))};return m.useEffect(()=>{c({selectedKey:l??null,inputValue:l??""})},[l]),e(xi,{size:"L",label:"Model",isRequired:!0,"data-testid":"model-picker",selectedKey:d.selectedKey,"aria-label":"model picker",onInputChange:y,inputValue:d.inputValue,onSelectionChange:p,width:"100%",allowsCustomValue:!0,onBlur:()=>{d.inputValue!==""&&n(d.inputValue)},onKeyUp:u=>{u.key==="Enter"&&n(d.inputValue)},menuTrigger:"focus",container:a,description:"Choose a model from the list, or enter a custom model name",defaultItems:s,...i,children:u=>e(Pi,{textValue:u.name,id:u.id,children:u.name},u.id)})}function hu(n){const[a,l,t]=x.useQueryLoader(Wi);return m.useEffect(()=>(l({providerKey:n.provider}),()=>t()),[t,l,n.provider]),a!=null?e(ES,{queryReference:a,...n}):null}const ku={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ModelProviderPickerFragment",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependenciesInstalled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dependencies",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};ku.hash="1d4ba7f81a958c9a17bd45dce0456ddb";function MS({onChange:n,query:a,...l}){var d,c;const t=x.useFragment(ku,a),i=t.modelProviders.filter(p=>p.dependenciesInstalled),r=i.length!==t.modelProviders.length,s=l.provider&&!i.some(p=>p.key===l.provider);return o(b,{direction:"row",gap:"size-100",children:[e(si,{label:"Provider","data-testid":"model-provider-picker",selectedKey:l.provider??void 0,"aria-label":"Model Provider",placeholder:"Select a provider",onSelectionChange:p=>{const y=p;Lc(y)&&n(y)},width:"100%",...l,children:t.modelProviders.map(p=>e(ue,{children:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(et,{provider:p.key,height:16}),p.name]})},p.key))}),s?o(Le,{delay:0,offset:5,children:[e("span",{children:e(Ne,{children:e(_,{color:"red-700",svg:e(qn,{})})})}),o(gn,{children:["The selected provider is not installed. Install"," ",((c=(d=t.modelProviders.find(p=>p.key===l.provider))==null?void 0:d.dependencies)==null?void 0:c.join(", "))??"the dependencies"," ","to use its models in Playground."]})]}):r?o(Le,{delay:0,offset:5,children:[e("span",{children:e(Ne,{children:e(_,{svg:e(qn,{})})})}),o(gn,{children:["Some providers are missing dependencies. Install them to use their models in Playground.",e("br",{}),e("br",{}),"Missing providers:",e("br",{}),t.modelProviders.filter(p=>!p.dependenciesInstalled).map(p=>{var y;return o(m.Fragment,{children:[((y=p.dependencies)==null?void 0:y.join(", "))??p.name,e("br",{})]},p.key)})]})]}):null]})}const VS=150,zS=F`
|
|
3359
3359
|
display: flex;
|
|
3360
3360
|
flex-direction: column;
|
|
3361
3361
|
gap: var(--ac-global-dimension-size-200);
|
|
@@ -3371,7 +3371,7 @@ fragment ModelProviderPickerFragment on Query {
|
|
|
3371
3371
|
}
|
|
3372
3372
|
padding: var(--ac-global-dimension-size-200);
|
|
3373
3373
|
overflow: auto;
|
|
3374
|
-
`;function NS({instance:n,container:a}){const l=O(r=>r.updateModel),t=m.useCallback(({configKey:r,value:s})=>{l({instanceId:n.id,patch:{...n.model,[r]:s}})},[n.id,n.model,l]),i=m.useMemo(()=>ii(r=>{t({configKey:"modelName",value:r})},250),[t]);return o(J,{children:[e(hu,{modelName:n.model.modelName,provider:n.model.provider,onChange:r=>{i(r)},container:a??void 0}),o(X,{defaultValue:n.model.baseUrl??"",onChange:r=>{t({configKey:"baseUrl",value:r})},children:[e(G,{children:"Base URL"}),e(Z,{placeholder:"e.x. https://my-llm.com/v1"})]})]})}function $S({instance:n,container:a}){const l=O(r=>r.updateModel),t=m.useCallback(({configKey:r,value:s})=>{l({instanceId:n.id,patch:{...n.model,[r]:s}})},[n.id,n.model,l]),i=m.useMemo(()=>ii(r=>{t({configKey:"modelName",value:r})},250),[t]);return o(J,{children:[o(X,{defaultValue:n.model.modelName??"",onChange:r=>{i(r)},children:[e(G,{children:"Deployment Name"}),e(Z,{placeholder:"e.x. azure-openai-deployment-name"})]}),o(X,{defaultValue:n.model.endpoint??"",onChange:r=>{t({configKey:"endpoint",value:r})},children:[e(G,{children:"Endpoint"}),e(Z,{placeholder:"e.x. https://my.openai.azure.com"})]}),e(xi,{container:a??void 0,size:"L",label:"API Version","data-testid":"azure-api-version-combobox",selectedKey:n.model.apiVersion??void 0,"aria-label":"api version picker",placeholder:"Select an AzureOpenAI API Version",inputValue:n.model.apiVersion??"",onInputChange:r=>{t({configKey:"apiVersion",value:r})},onSelectionChange:r=>{typeof r=="string"&&t({configKey:"apiVersion",value:r})},allowsCustomValue:!0,children:lf.map(r=>e(Pi,{textValue:r,id:r,children:r},r))})]})}function jS(n){const[a,l]=m.useState(null),t=O(d=>d.instances.find(c=>c.id===n.playgroundInstanceId));if(!t)throw new Error(`Playground instance ${n.playgroundInstanceId} not found`);const i=t.model.supportedInvocationParameters,r=t.model.invocationParameters,s=Ks(r,i);return o(m.Fragment,{children:[e(E,{size:"S",onPress:()=>{m.startTransition(()=>{l(e(OS,{...n}))})},leadingVisual:e(et,{provider:t.model.provider,height:16}),children:o(b,{direction:"row",gap:"size-100",alignItems:"center",height:"100%",children:[e(
|
|
3374
|
+
`;function NS({instance:n,container:a}){const l=O(r=>r.updateModel),t=m.useCallback(({configKey:r,value:s})=>{l({instanceId:n.id,patch:{...n.model,[r]:s}})},[n.id,n.model,l]),i=m.useMemo(()=>ii(r=>{t({configKey:"modelName",value:r})},250),[t]);return o(J,{children:[e(hu,{modelName:n.model.modelName,provider:n.model.provider,onChange:r=>{i(r)},container:a??void 0}),o(X,{defaultValue:n.model.baseUrl??"",onChange:r=>{t({configKey:"baseUrl",value:r})},children:[e(G,{children:"Base URL"}),e(Z,{placeholder:"e.x. https://my-llm.com/v1"})]})]})}function $S({instance:n,container:a}){const l=O(r=>r.updateModel),t=m.useCallback(({configKey:r,value:s})=>{l({instanceId:n.id,patch:{...n.model,[r]:s}})},[n.id,n.model,l]),i=m.useMemo(()=>ii(r=>{t({configKey:"modelName",value:r})},250),[t]);return o(J,{children:[o(X,{defaultValue:n.model.modelName??"",onChange:r=>{i(r)},children:[e(G,{children:"Deployment Name"}),e(Z,{placeholder:"e.x. azure-openai-deployment-name"})]}),o(X,{defaultValue:n.model.endpoint??"",onChange:r=>{t({configKey:"endpoint",value:r})},children:[e(G,{children:"Endpoint"}),e(Z,{placeholder:"e.x. https://my.openai.azure.com"})]}),e(xi,{container:a??void 0,size:"L",label:"API Version","data-testid":"azure-api-version-combobox",selectedKey:n.model.apiVersion??void 0,"aria-label":"api version picker",placeholder:"Select an AzureOpenAI API Version",inputValue:n.model.apiVersion??"",onInputChange:r=>{t({configKey:"apiVersion",value:r})},onSelectionChange:r=>{typeof r=="string"&&t({configKey:"apiVersion",value:r})},allowsCustomValue:!0,children:lf.map(r=>e(Pi,{textValue:r,id:r,children:r},r))})]})}function jS(n){const[a,l]=m.useState(null),t=O(d=>d.instances.find(c=>c.id===n.playgroundInstanceId));if(!t)throw new Error(`Playground instance ${n.playgroundInstanceId} not found`);const i=t.model.supportedInvocationParameters,r=t.model.invocationParameters,s=Ks(r,i);return o(m.Fragment,{children:[e(E,{size:"S",onPress:()=>{m.startTransition(()=>{l(e(OS,{...n}))})},leadingVisual:e(et,{provider:t.model.provider,height:16}),children:o(b,{direction:"row",gap:"size-100",alignItems:"center",height:"100%",children:[e(dn,{maxWidth:VS,children:e(C,{children:t.model.modelName||"--"})}),s?null:o(Le,{delay:0,offset:5,children:[e("span",{children:e(Ne,{children:e(_,{color:"danger",svg:e(qn,{})})})}),e(gn,{children:"Some required invocation parameters are not configured."})]})]})}),e(re,{type:"slideOver",isDismissable:!0,onDismiss:()=>{l(null)},children:a})]})}function OS(n){const a=O(r=>r.instances.find(s=>s.id===n.playgroundInstanceId));if(!a)throw new Error(`Playground instance ${n.playgroundInstanceId} not found`);const l=cn(r=>r.setModelConfigForProvider),t=me(),i=m.useCallback(()=>{const{supportedInvocationParameters:r,...s}=a.model;l({provider:a.model.provider,modelConfig:s}),t({title:"Model Configuration Saved",message:`${Gt[a.model.provider]} model configuration saved as default for later use.`,expireMs:3e3})},[a.model,t,l]);return e(te,{title:"Model Configuration",size:"M",extra:o(Le,{delay:0,offset:5,children:[e(E,{size:"S",variant:"default",onPress:i,leadingVisual:e(_,{svg:e(Ko,{})}),children:"Save as Default"}),o(gn,{children:["Saves the current configuration as the default for"," ",Gt[a.model.provider]??"this provider","."]})]}),children:e(m.Suspense,{children:e(QS,{...n})})})}function QS(n){const{playgroundInstanceId:a}=n,l=O(f=>f.instances.find(k=>k.id===a));if(!l)throw new Error(`Playground instance ${n.playgroundInstanceId} not found`);const t=cn(f=>f.modelConfigByProvider),i=O(f=>f.updateProvider),r=O(f=>f.updateModel),s=l.model.supportedInvocationParameters,d=l.model.invocationParameters,c=Ks(d,s),p=x.useLazyLoadQuery(fu,{}),y=m.useCallback(f=>{r({instanceId:a,patch:{modelName:f}})},[a,r]),[u,g]=m.useState();return o("form",{css:zS,children:[c?null:o(b,{direction:"row",gap:"size-100",children:[e(_,{color:"danger",svg:e(qn,{})}),e(C,{color:"danger",children:"Some required invocation parameters are not configured."})]}),e(MS,{provider:l.model.provider,query:p,onChange:f=>{i({instanceId:a,provider:f,modelConfigByProvider:t})}}),l.model.provider==="OPENAI"?e(NS,{instance:l,container:u??null}):l.model.provider==="AZURE_OPENAI"?e($S,{instance:l,container:u??null}):e(hu,{modelName:l.model.modelName,provider:l.model.provider,onChange:y,container:u??void 0}),e(m.Suspense,{children:e(RS,{instanceId:a})}),e("div",{ref:g})]})}const bu=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a={alias:null,args:null,kind:"ScalarField",name:"invocationInputField",storageKey:null},l={alias:"floatDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},t=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:null,kind:"LinkedField",name:"modelInvocationParameters",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"canonicalName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"required",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null}],type:"InvocationParameterBase",abstractKey:"__isInvocationParameterBase"},{kind:"InlineFragment",selections:[{alias:"booleanDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"BooleanInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[l,a,{alias:null,args:null,kind:"ScalarField",name:"minValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"maxValue",storageKey:null}],type:"BoundedFloatInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[l,a],type:"FloatInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"intDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"IntInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"jsonDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"JSONInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"stringDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"StringInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:[{alias:"stringListDefaultValue",args:null,kind:"ScalarField",name:"defaultValue",storageKey:null},a],type:"StringListInvocationParameter",abstractKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ModelSupportedParamsFetcherQuery",selections:t,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ModelSupportedParamsFetcherQuery",selections:t},params:{cacheID:"8f18509b17f3f97c2413ef8b6557d972",id:null,metadata:{},name:"ModelSupportedParamsFetcherQuery",operationKind:"query",text:`query ModelSupportedParamsFetcherQuery(
|
|
3375
3375
|
$input: ModelsInput!
|
|
3376
3376
|
) {
|
|
3377
3377
|
modelInvocationParameters(input: $input) {
|
|
@@ -3415,28 +3415,28 @@ fragment ModelProviderPickerFragment on Query {
|
|
|
3415
3415
|
}
|
|
3416
3416
|
}
|
|
3417
3417
|
}
|
|
3418
|
-
`}}}();bu.hash="8bf1a32724929bdc4a02d32809ba59d7";const BS=({instanceId:n})=>{var p;const l=O(y=>y.instances).find(y=>y.id===n);if(!l)throw new Error("Instance not found");const t=l.model.provider,i=l.model.modelName,r=
|
|
3418
|
+
`}}}();bu.hash="8bf1a32724929bdc4a02d32809ba59d7";const BS=({instanceId:n})=>{var p;const l=O(y=>y.instances).find(y=>y.id===n);if(!l)throw new Error("Instance not found");const t=l.model.provider,i=l.model.modelName,r=cn(y=>y.modelConfigByProvider),s=O(y=>y.updateModelSupportedInvocationParameters),{modelInvocationParameters:d}=x.useLazyLoadQuery(bu,{input:{providerKey:t,modelName:i}}),c=(p=l.prompt)==null?void 0:p.id;return m.useEffect(()=>{s({instanceId:n,supportedInvocationParameters:d,modelConfigByProvider:r})},[d,n,s,r,c]),null},Su=n=>a=>a.instances.find(l=>l.id===n),ni=n=>a=>a.allInstanceMessages[n];function qS({playgroundInstanceId:n,messageId:a}){const l=m.useMemo(()=>Su(n),[n]),t=O(l);if(t==null)throw new Error(`Instance ${n} not found`);const i=t.model.provider,r=Ya(),s=m.useMemo(()=>ni(a),[a]),d=O(s);if(d==null)throw new Error(`Message ${a} not found`);const c=d.toolCalls,p=O(k=>k.updateMessage),[y,u]=m.useState(()=>JSON.stringify(c,null,2));m.useEffect(()=>{const k=r.getState();if(k.instances.find(I=>I.id===n)==null)return;const S=ni(a)(k);if(S==null)return;const K=S.toolCalls,P=JSON.stringify(K,null,2);Ii({str:P,excludeNull:!0})&&u(P)},[i,r,n,a]);const g=m.useCallback(k=>{const{json:h}=Qe(k);p({instanceId:n,messageId:a,patch:{toolCalls:h}})},[n,a,p]),f=m.useMemo(()=>{switch(t.model.provider){case"OPENAI":case"AZURE_OPENAI":case"DEEPSEEK":return rf;case"ANTHROPIC":return tf;case"GOOGLE":return null}},[t.model.provider]);return e(on,{value:y,jsonSchema:f,onChange:g})}function US(n){return n==="text"||n==="toolCalls"}function HS({messageMode:n,onChange:a}){return o(yt,{selectedKeys:[n],size:"S","aria-label":"Message Mode",onSelectionChange:l=>{if(l.size===0)return;const t=l.keys().next().value;US(t)&&a(t)},children:[o(Le,{placement:"top",delay:0,offset:10,children:[e(Fn,{"aria-label":"text input",id:"text",children:e(_,{svg:e(hi,{})})}),e(gn,{children:"Text input"})]}),o(Le,{placement:"top",delay:0,offset:10,children:[e(Fn,{"aria-label":"tool calling",id:"toolCalls",children:e(_,{svg:e(ki,{})})}),e(gn,{children:"Tool calling"})]})]})}const GS=F`
|
|
3419
3419
|
.ac-field-label {
|
|
3420
3420
|
display: none;
|
|
3421
3421
|
}
|
|
3422
|
-
`;function WS({role:n,includeLabel:a=!0,onChange:l}){return o(sf,{selectedKey:n,css:a?void 0:GS,"data-testid":"messages-role-picker","aria-label":"Role for the chat message",size:"S",onSelectionChange:t=>{if(!hs(t))throw new Error(`Invalid chat message role: ${t}`);l(t)},children:[a&&e(G,{children:"Role"}),o(E,{children:[e(Sp,{}),e(of,{})]}),e(Oa,{placement:"bottom start",offset:4,shouldFlip:!0,containerPadding:8,children:o(Io,{children:[e(Rl,{id:"system",children:"System"}),e(Rl,{id:"user",children:"User"}),e(Rl,{id:"ai",children:"AI"}),e(Rl,{id:"tool",children:"Tool"})]})})]})}const JS=32;function ZS({instanceId:n,hasResponseFormat:a}){const l=O(u=>u.instances),t=O(u=>u.updateInstance),i=O(u=>u.addMessage),r=O(u=>u.upsertInvocationParameterInput),s=l.find(u=>u.id===n);if(!s)throw new Error(`Playground instance ${n} not found`);const{template:d}=s;if(d.__type!=="chat")throw new Error(`Invalid template type ${d.__type}`);const c=s.model.supportedInvocationParameters,p=c==null?void 0:c.some(u=>ga(u,{canonicalName:wn,invocationName:_n})),y=c==null?void 0:c.some(u=>ga(u,{canonicalName:ca,invocationName:ja}));return o(b,{direction:"row",justifyContent:"end",gap:"size-100",minHeight:JS,children:[p?e(E,{size:"S","aria-label":"response format",leadingVisual:e(_,{svg:e(da,{})}),isDisabled:a,onPress:()=>{r({instanceId:n,invocationParameterInput:{valueJson:df(),invocationName:_n,canonicalName:wn}})},children:"Response Format"}):null,y?e(E,{"aria-label":"add tool",size:"S",leadingVisual:e(_,{svg:e(da,{})}),onPress:()=>{const u={tools:[...s.tools,d0({provider:s.model.provider,toolNumber:s.tools.length+1})]};if(s.tools.length===0){const g=pi({toolChoice:"auto",targetProvider:s.model.provider});g&&(u.toolChoice=g)}t({instanceId:n,patch:u,dirty:!0})},children:"Tool"}):null,e(E,{"aria-label":"add message",size:"S",leadingVisual:e(_,{svg:e(da,{})}),onPress:()=>{i({playgroundInstanceId:n,messages:[{id:oa(),role:"user",content:""}]})},children:"Message"})]})}const XS=400;function YS({playgroundInstanceId:n}){const a=O(u=>u.deleteInvocationParameterInput),l=O(u=>u.instances.find(g=>g.id===n)),t=l==null?void 0:l.model.provider,i=O(u=>u.upsertInvocationParameterInput);if(!l)throw new Error(`Instance ${n} not found`);const r=l.model.invocationParameters.find(u=>u.invocationName===_n||u.canonicalName===wn),[s,d]=m.useState(()=>JSON.stringify((r==null?void 0:r.valueJson)??{},null,2)),c=m.useRef(s),p=Ya();m.useEffect(()=>{const g=p.getState().instances.find(h=>h.id===n);if(g==null)return;const f=g.model.invocationParameters.find(h=>h.invocationName===_n||h.canonicalName===wn);if(f==null)return;const k=JSON.stringify(f.valueJson,null,2);Ii({str:k,excludeNull:!0})&&d(k)},[t,p,n]);const y=m.useCallback(u=>{c.current=u;const{json:g}=Qe(u);i({instanceId:n,invocationParameterInput:{invocationName:_n,valueJson:g,canonicalName:wn}})},[n,i]);return o(fe,{id:"response-format",children:[e(pe,{arrowPosition:"start",children:"Response Format"}),e(ye,{children:e(v,{padding:"size-200",children:e(B,{variant:"compact",title:"Schema",bodyStyle:{padding:0},extra:o(b,{direction:"row",gap:"size-100",children:[e(de,{text:c}),e(E,{"aria-label":"Delete Response Format",leadingVisual:e(_,{svg:e(
|
|
3422
|
+
`;function WS({role:n,includeLabel:a=!0,onChange:l}){return o(sf,{selectedKey:n,css:a?void 0:GS,"data-testid":"messages-role-picker","aria-label":"Role for the chat message",size:"S",onSelectionChange:t=>{if(!hs(t))throw new Error(`Invalid chat message role: ${t}`);l(t)},children:[a&&e(G,{children:"Role"}),o(E,{children:[e(Sp,{}),e(of,{})]}),e(Oa,{placement:"bottom start",offset:4,shouldFlip:!0,containerPadding:8,children:o(Io,{children:[e(Rl,{id:"system",children:"System"}),e(Rl,{id:"user",children:"User"}),e(Rl,{id:"ai",children:"AI"}),e(Rl,{id:"tool",children:"Tool"})]})})]})}const JS=32;function ZS({instanceId:n,hasResponseFormat:a}){const l=O(u=>u.instances),t=O(u=>u.updateInstance),i=O(u=>u.addMessage),r=O(u=>u.upsertInvocationParameterInput),s=l.find(u=>u.id===n);if(!s)throw new Error(`Playground instance ${n} not found`);const{template:d}=s;if(d.__type!=="chat")throw new Error(`Invalid template type ${d.__type}`);const c=s.model.supportedInvocationParameters,p=c==null?void 0:c.some(u=>ga(u,{canonicalName:wn,invocationName:_n})),y=c==null?void 0:c.some(u=>ga(u,{canonicalName:ca,invocationName:ja}));return o(b,{direction:"row",justifyContent:"end",gap:"size-100",minHeight:JS,children:[p?e(E,{size:"S","aria-label":"response format",leadingVisual:e(_,{svg:e(da,{})}),isDisabled:a,onPress:()=>{r({instanceId:n,invocationParameterInput:{valueJson:df(),invocationName:_n,canonicalName:wn}})},children:"Response Format"}):null,y?e(E,{"aria-label":"add tool",size:"S",leadingVisual:e(_,{svg:e(da,{})}),onPress:()=>{const u={tools:[...s.tools,d0({provider:s.model.provider,toolNumber:s.tools.length+1})]};if(s.tools.length===0){const g=pi({toolChoice:"auto",targetProvider:s.model.provider});g&&(u.toolChoice=g)}t({instanceId:n,patch:u,dirty:!0})},children:"Tool"}):null,e(E,{"aria-label":"add message",size:"S",leadingVisual:e(_,{svg:e(da,{})}),onPress:()=>{i({playgroundInstanceId:n,messages:[{id:oa(),role:"user",content:""}]})},children:"Message"})]})}const XS=400;function YS({playgroundInstanceId:n}){const a=O(u=>u.deleteInvocationParameterInput),l=O(u=>u.instances.find(g=>g.id===n)),t=l==null?void 0:l.model.provider,i=O(u=>u.upsertInvocationParameterInput);if(!l)throw new Error(`Instance ${n} not found`);const r=l.model.invocationParameters.find(u=>u.invocationName===_n||u.canonicalName===wn),[s,d]=m.useState(()=>JSON.stringify((r==null?void 0:r.valueJson)??{},null,2)),c=m.useRef(s),p=Ya();m.useEffect(()=>{const g=p.getState().instances.find(h=>h.id===n);if(g==null)return;const f=g.model.invocationParameters.find(h=>h.invocationName===_n||h.canonicalName===wn);if(f==null)return;const k=JSON.stringify(f.valueJson,null,2);Ii({str:k,excludeNull:!0})&&d(k)},[t,p,n]);const y=m.useCallback(u=>{c.current=u;const{json:g}=Qe(u);i({instanceId:n,invocationParameterInput:{invocationName:_n,valueJson:g,canonicalName:wn}})},[n,i]);return o(fe,{id:"response-format",children:[e(pe,{arrowPosition:"start",children:"Response Format"}),e(ye,{children:e(v,{padding:"size-200",children:e(B,{variant:"compact",title:"Schema",bodyStyle:{padding:0},extra:o(b,{direction:"row",gap:"size-100",children:[e(de,{text:c}),e(E,{"aria-label":"Delete Response Format",leadingVisual:e(_,{svg:e(Ge,{})}),size:"S",onPress:()=>{a({instanceId:n,invocationParameterInputInvocationName:_n})}})]}),children:e(Oo,{preInitializationMinHeight:XS,children:e(on,{value:s,onChange:y,jsonSchema:Bh})})})})})]})}const ev=400;function nv({playgroundInstanceId:n,toolId:a}){const l=Ya(),t=O(k=>k.updateInstance),i=O(k=>k.instances.find(h=>h.id===n));if(i==null)throw new Error(`Playground instance ${n} not found`);const r=i.model.provider,s=i.tools,d=s.find(k=>k.id===a);if(d==null)throw new Error(`Tool ${a} not found`);const[c,p]=m.useState(()=>JSON.stringify(d.definition,null,2)),y=m.useRef(c);m.useEffect(()=>{const h=l.getState().instances.find(P=>P.id===n);if(h==null)return;const S=h.tools.find(P=>P.id===a);if(S==null)return;const K=JSON.stringify(S.definition,null,2);Ii({str:K,excludeNull:!0})&&p(K)},[r,l,n,a]);const u=m.useCallback(k=>{y.current=k;const{json:h}=Qe(k);t({instanceId:n,patch:{tools:s.map(S=>S.id===d.id?{...S,definition:h}:S)},dirty:!0})},[s,n,d.id,t]),g=m.useMemo(()=>Cs(d),[d]),f=m.useMemo(()=>{switch(i.model.provider){case"OPENAI":case"AZURE_OPENAI":case"DEEPSEEK":return uf;case"ANTHROPIC":return cf;case"GOOGLE":return null}},[i.model.provider]);return e(B,{collapsible:!0,backgroundColor:"yellow-100",borderColor:"yellow-700",variant:"compact",title:o(b,{direction:"row",gap:"size-100",children:[e(Ki,{spanKind:"tool"}),e(C,{children:g??"Tool"})]}),bodyStyle:{padding:0},extra:o(b,{direction:"row",gap:"size-100",children:[e(de,{text:y}),e(E,{"aria-label":"Delete tool",leadingVisual:e(_,{svg:e(Ge,{})}),size:"S",onPress:()=>{const k=s.filter(K=>K.id!==d.id),h=typeof i.toolChoice=="object"&&g!=null&&mf(i.toolChoice)===g;let S=i.toolChoice;k.length===0?S=void 0:h&&(S="auto"),t({instanceId:n,patch:{tools:k,toolChoice:S},dirty:!0})}})]}),children:e(Oo,{preInitializationMinHeight:ev,children:e(on,{value:c,onChange:u,jsonSchema:f})})})}function av(n){const a=n.playgroundInstanceId,l=O(d=>d.instances.find(c=>c.id===n.playgroundInstanceId)),t=O(d=>d.updateInstance);if(l==null)throw new Error(`Playground instance ${a} not found`);const{tools:i}=l;if(i==null)throw new Error(`Playground instance ${a} does not have tools`);const r=m.useMemo(()=>i.map(d=>Cs(d)).filter(d=>d!=null),[i]),s=l.model.provider;return gf(s)?o(fe,{id:"tools",children:[o(pe,{arrowPosition:"start",children:["Tools",e(xn,{children:i.length})]}),e(ye,{children:e(v,{padding:"size-200",children:o(b,{direction:"column",children:[e(Xl,{children:e(pf,{provider:s,choice:l.toolChoice,onChange:d=>{t({instanceId:a,patch:{toolChoice:d},dirty:!0})},toolNames:r})}),e(b,{direction:"column",gap:"size-200",children:i.map(d=>e(nv,{playgroundInstanceId:a,toolId:d.id},d.id))})]})})})]}):null}const vu=1,lv=vu+1;function tv(n){const a=n.playgroundInstanceId,l=O(u=>u.templateFormat),t=O(u=>u.updateInstance),i=m.useMemo(()=>Su(a),[a]),r=O(i);if(!r)throw new Error(`Playground instance ${a} not found`);const s=r.tools.length>0,d=r.model.invocationParameters.find(u=>ga(u,{canonicalName:wn,invocationName:_n}))!=null,{template:c}=r;if(c.__type!=="chat")throw new Error(`Invalid template type ${c.__type}`);const p=c.messageIds,y=vp(ir(xp),ir(Pp,{coordinateGetter:Tp}));return o(Kp,{sensors:y,onDragEnd:({active:u,over:g})=>{if(!g||u.id===g.id)return;const f=p.findIndex(S=>S===u.id),k=p.findIndex(S=>S===g.id),h=Fp(p,f,k);t({instanceId:a,patch:{template:{__type:"chat",messageIds:h}},dirty:!0})},children:[e(Cp,{items:p,children:e("ul",{css:F`
|
|
3423
3423
|
display: flex;
|
|
3424
3424
|
flex-direction: column;
|
|
3425
3425
|
gap: var(--ac-global-dimension-size-200);
|
|
3426
3426
|
padding: var(--ac-global-dimension-size-200);
|
|
3427
|
-
`,children:p.map(u=>e(rv,{playgroundInstanceId:a,templateFormat:l,messageId:u},u))})}),e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderColor:"dark",borderTopWidth:"thin",borderBottomWidth:s||d?"thin":void 0,children:e(ZS,{instanceId:a,hasResponseFormat:d})}),s||d?o(bn,{defaultExpandedKeys:["tools","response-format"],children:[s?e(av,{...n}):null,d?e(YS,{...n}):null]}):null]})}function iv({message:n,updateMessage:a,templateFormat:l,playgroundInstanceId:t,messageMode:i}){const r=m.useCallback(s=>{a({content:s})},[a]);return i==="toolCalls"?e(v,{paddingTop:"size-100",paddingStart:"size-250",paddingEnd:"size-250",paddingBottom:"size-200",children:e(ba,{label:"Tool Calls",children:e(
|
|
3427
|
+
`,children:p.map(u=>e(rv,{playgroundInstanceId:a,templateFormat:l,messageId:u},u))})}),e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderColor:"dark",borderTopWidth:"thin",borderBottomWidth:s||d?"thin":void 0,children:e(ZS,{instanceId:a,hasResponseFormat:d})}),s||d?o(bn,{defaultExpandedKeys:["tools","response-format"],children:[s?e(av,{...n}):null,d?e(YS,{...n}):null]}):null]})}function iv({message:n,updateMessage:a,templateFormat:l,playgroundInstanceId:t,messageMode:i}){const r=m.useCallback(s=>{a({content:s})},[a]);return i==="toolCalls"?e(v,{paddingTop:"size-100",paddingStart:"size-250",paddingEnd:"size-250",paddingBottom:"size-200",children:e(ba,{label:"Tool Calls",children:e(Ze,{width:"100%",children:e(qS,{playgroundInstanceId:t,messageId:n.id})})})}):n.role==="tool"?o(Xl,{onSubmit:s=>{s.preventDefault()},children:[e(v,{paddingX:"size-200",paddingY:"size-100",borderColor:"yellow-700",borderBottomWidth:"thin",children:e(X,{value:n.toolCallId,onChange:s=>a({toolCallId:s}),"aria-label":"Tool Call ID",size:"S",children:e(Z,{placeholder:"Tool Call ID"})})}),e(on,{value:n.content??'""',"aria-label":"tool message content",height:"100%",onChange:s=>a({content:s})})]}):e(tt,{children:e(it,{height:"100%",defaultValue:n.content||"","aria-label":"Message content",templateFormat:l,onChange:r})})}function rv({playgroundInstanceId:n,templateFormat:a,messageId:l}){const t=O(M=>M.updateMessage),i=O(M=>M.deleteMessage),{attributes:r,listeners:s,setNodeRef:d,transform:c,transition:p,setActivatorNodeRef:y,isDragging:u}=Ip({id:l}),g=m.useMemo(()=>M=>{var N;return(N=M.instances.find(j=>j.id===n))==null?void 0:N.model},[n]),f=O(g);if(!f)throw new Error(`Instance model not found for instance ${n}`);const k=m.useMemo(()=>ni(l),[l]),h=O(k),S=Dl(h.role),K={transform:Dp.Translate.toString(c),transition:p,zIndex:u?lv:vu},P=h.toolCalls!=null&&h.toolCalls.length>0,[I,D]=m.useState(P?"toolCalls":"text"),[T,L]=m.useState(h.content),[V,w]=m.useState(h.toolCalls),$=m.useCallback(M=>{t({instanceId:n,messageId:l,patch:M})},[n,l,t]);return e("li",{ref:d,style:K,children:e(B,{collapsible:!0,variant:"compact",bodyStyle:{padding:0},...S,title:e("div",{css:F`
|
|
3428
3428
|
// Align the role picker with the prompt picker in PlaygroundTemplate header
|
|
3429
3429
|
margin-left: var(--ac-global-dimension-size-150);
|
|
3430
|
-
`,children:e(WS,{includeLabel:!1,role:h.role,onChange:M=>{let N=h.content,j=h.toolCalls;M!=="ai"&&(j=void 0,D("text")),M==="tool"&&(N='""'),t({instanceId:n,messageId:l,patch:{role:M,toolCalls:j,content:N}})}})}),extra:o(b,{direction:"row",gap:"size-100",children:[h.role==="ai"?e(HS,{messageMode:I,onChange:M=>{switch(D(M),M){case"text":w(h.toolCalls),t({instanceId:n,messageId:l,patch:{content:T,toolCalls:void 0}});break;case"toolCalls":L(h.content),t({instanceId:n,messageId:l,patch:{content:"",toolCalls:V!=null?$o({toolCalls:V,provider:f.provider}):[c0(f.provider)]}});break;default:Pe()}}}):null,e(de,{text:I==="toolCalls"?En(h.toolCalls).json??"":h.content??""}),e(E,{"aria-label":"Delete message",leadingVisual:e(_,{svg:e(
|
|
3430
|
+
`,children:e(WS,{includeLabel:!1,role:h.role,onChange:M=>{let N=h.content,j=h.toolCalls;M!=="ai"&&(j=void 0,D("text")),M==="tool"&&(N='""'),t({instanceId:n,messageId:l,patch:{role:M,toolCalls:j,content:N}})}})}),extra:o(b,{direction:"row",gap:"size-100",children:[h.role==="ai"?e(HS,{messageMode:I,onChange:M=>{switch(D(M),M){case"text":w(h.toolCalls),t({instanceId:n,messageId:l,patch:{content:T,toolCalls:void 0}});break;case"toolCalls":L(h.content),t({instanceId:n,messageId:l,patch:{content:"",toolCalls:V!=null?$o({toolCalls:V,provider:f.provider}):[c0(f.provider)]}});break;default:Pe()}}}):null,e(de,{text:I==="toolCalls"?En(h.toolCalls).json??"":h.content??""}),e(E,{"aria-label":"Delete message",leadingVisual:e(_,{svg:e(Ge,{})}),size:"S",onPress:()=>{i({instanceId:n,messageId:l})}}),e(yf,{ref:y,listeners:s,attributes:r})]}),children:e("div",{children:e(iv,{message:h,messageMode:I,playgroundInstanceId:n,templateFormat:a,updateMessage:$})})})})}function ov(n){const[a,l]=m.useState(null),t=n.playgroundInstanceId,i=O(h=>h.updateInstance),r=O(h=>h.addMessage),s=O(h=>h.setDirty),d=O(h=>h.instances),c=d.find(h=>h.id===t),p=d.findIndex(h=>h.id===t),y=c==null?void 0:c.prompt,u=y==null?void 0:y.id,g=O(h=>h.dirtyInstances[t]),f=m.useCallback(async h=>{if(!h){i({instanceId:t,patch:{prompt:null},dirty:!1});return}const S=await pc(h);S&&(i({instanceId:t,patch:{...S.instance,template:{__type:"chat",messageIds:[]}},dirty:!1}),r({playgroundInstanceId:t,messages:S.instance.template.messages}),s(t,!1))},[t,i,r,s]);if(!c)throw new Error(`Playground instance ${t} not found`);const{template:k}=c;return o(J,{children:[e(B,{title:o(b,{direction:"row",gap:"size-100",alignItems:"center",marginEnd:"size-100",children:[e(Ti,{index:p}),e(pu,{promptId:u,onChange:f})]}),collapsible:!0,variant:"compact",bodyStyle:{padding:0},extra:o(b,{direction:"row",gap:"size-100",children:[e(m.Suspense,{fallback:e("div",{children:e(ge,{size:"S"})}),children:e(BS,{instanceId:t})}),e(jS,{...n}),e(dv,{instanceId:t,setDialog:l,dirty:g}),d.length>1?e(sv,{...n}):null]}),children:k.__type==="chat"?e(m.Suspense,{children:e(tv,{...n})}):"Completion Template"}),e(re,{isDismissable:!0,onDismiss:()=>{l(null)},children:a})]})}function sv(n){const a=O(l=>l.deleteInstance);return o(Le,{children:[e(Ne,{children:e(E,{size:"S","aria-label":"Delete this instance of the playground",leadingVisual:e(_,{svg:e(Ge,{})}),onPress:()=>{a(n.playgroundInstanceId)}})}),e(gn,{children:e(ka,{children:"Delete this instance of the playground"})})]})}function dv({instanceId:n,setDialog:a,dirty:l}){const t=O(r=>r.instances.find(s=>s.id===n));if(!t)throw new Error(`Instance ${n} not found`);return e(J,{children:o(Le,{delay:100,offset:5,placement:"top",children:[e(Ne,{children:e(E,{variant:l?"primary":void 0,size:"S",onPress:()=>{var r;a(e(xS,{instanceId:n,setDialog:a,selectedPromptId:(r=t.prompt)==null?void 0:r.id}))},children:"Save"})}),e(gn,{children:e(ka,{children:"Save this prompt"})})]})})}function cv({size:n}){const a=O(t=>t.templateFormat),l=O(t=>t.setTemplateFormat);return e("div",{css:F`
|
|
3431
3431
|
& * {
|
|
3432
3432
|
white-space: nowrap;
|
|
3433
3433
|
}
|
|
3434
|
-
`,children:o(yt,{size:n,defaultSelectedKeys:[a],"aria-label":"Template Format",onSelectionChange:t=>{if(t.size===0)return;const i=t.keys().next().value;typeof i=="string"&&ff(i)&&l(i)},children:[e(Fn,{"aria-label":"None",id:
|
|
3434
|
+
`,children:o(yt,{size:n,defaultSelectedKeys:[a],"aria-label":"Template Format",onSelectionChange:t=>{if(t.size===0)return;const i=t.keys().next().value;typeof i=="string"&&ff(i)&&l(i)},children:[e(Fn,{"aria-label":"None",id:fn.NONE,children:"None"}),e(Fn,{"aria-label":"Mustache",id:fn.Mustache,children:"Mustache"}),e(Fn,{"aria-label":"F-String",id:fn.FString,children:"F-String"})]})})}const uv=F`
|
|
3435
3435
|
display: flex;
|
|
3436
3436
|
overflow: hidden;
|
|
3437
3437
|
flex-direction: column;
|
|
3438
3438
|
height: 100%;
|
|
3439
|
-
`;function Ji(n){const{modelProviders:a}=x.useLazyLoadQuery(yc,{}),l=
|
|
3439
|
+
`;function Ji(n){const{modelProviders:a}=x.useLazyLoadQuery(yc,{}),l=cn(r=>r.modelConfigByProvider),t=cn(r=>r.playgroundStreamingEnabled);return a.some(r=>r.dependenciesInstalled)?o(D1,{...n,streaming:t,modelConfigByProvider:l,children:[o("div",{css:uv,children:[e(v,{borderBottomColor:"dark",borderBottomWidth:"thin",padding:"size-200",flex:"none",children:o(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(ae,{level:1,children:"Playground"}),o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(KS,{}),e(cS,{}),e(j1,{}),e(FS,{})]})]})}),e(bv,{})]}),e(m.Suspense,{children:e(M1,{})})]}):e(N1,{availableProviders:a})}function mv(){const n=O(i=>i.addInstance),a=O(i=>i.instances),l=a.length,t=a.some(i=>i.activeRunId!=null);return e(E,{size:"S","aria-label":"add prompt",leadingVisual:e(_,{svg:e(Nn,{})}),isDisabled:l>=Sh||t,onPress:()=>{n()},children:"Compare"})}const gv=F`
|
|
3440
3440
|
display: flex;
|
|
3441
3441
|
flex-direction: column;
|
|
3442
3442
|
height: 100%;
|
|
@@ -3477,7 +3477,7 @@ fragment ModelProviderPickerFragment on Query {
|
|
|
3477
3477
|
`,yv=F`
|
|
3478
3478
|
height: 100%;
|
|
3479
3479
|
overflow: auto;
|
|
3480
|
-
`,fv=632,hv=["prompts"],kv=["input","output"];function bv(){const n=O(u=>u.templateFormat),[a]=
|
|
3480
|
+
`,fv=632,hv=["prompts"],kv=["input","output"];function bv(){const n=O(u=>u.templateFormat),[a]=mn(),l=a.get("datasetId"),t=l!=null,r=O(u=>u.instances.length)===1,s=O(u=>u.instances.some(g=>g.activeRunId!=null)),d=O(u=>Object.values(u.dirtyInstances).some(g=>g)),c=O(u=>u.instances.map(g=>g.id),(u,g)=>u.length===g.length&&u.every((f,k)=>f===g[k])),p=m.useCallback(({currentLocation:u,nextLocation:g})=>{const f=u.pathname!==g.pathname;return(s||d)&&f},[s,d]),y=Lp(p);return m.useEffect(()=>{const u=s,g=f=>{f.preventDefault(),f.returnValue=!0};if(u)return window.addEventListener("beforeunload",g),()=>{window.removeEventListener("beforeunload",g)}},[s]),o(m.Fragment,{children:[o(Pn,{direction:r&&!t?"horizontal":"vertical",autoSaveId:r?"playground-horizontal":"playground-vertical",children:[e(Re,{children:e("div",{css:gv,children:e(bn,{defaultExpandedKeys:hv,children:o(fe,{id:"prompts",size:"L",children:[o(pe,{arrowPosition:"start",justifyContent:"space-between",children:["Prompts",e(Tl,{children:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(cv,{size:"S"}),e(mv,{})]})})]}),e(ye,{children:e("div",{css:pv,children:e(b,{direction:"row",gap:"size-200",maxWidth:"100%",children:c.map(u=>e(v,{flex:"1 1 0px",minWidth:fv,children:e(ov,{playgroundInstanceId:u})},`${u}-prompt`))})})})]})})})}),e(Rn,{css:pt}),e(Re,{children:t?e(m.Suspense,{fallback:e(ge,{}),children:e(sS,{datasetId:l})}):e("div",{css:yv,children:o(bn,{defaultExpandedKeys:kv,children:[n!==fn.NONE?o(fe,{id:"input",size:"L",children:[e(pe,{arrowPosition:"start",children:"Inputs"}),e(ye,{children:e(v,{padding:"size-200",height:"100%",children:e(yS,{})})})]}):null,o(fe,{id:"output",size:"L",children:[e(pe,{arrowPosition:"start",children:"Output"}),e(ye,{children:e(v,{padding:"size-200",height:"100%",children:e(b,{direction:"row",gap:"size-200",children:c.map(u=>e(v,{flex:"1 1 0px",children:e(vS,{playgroundInstanceId:u})},`${u}-output`))})})})]})]})})})]}),y!=null&&e(hf,{blocker:y,message:s?"Playground run is still in progress, leaving the page may result in incomplete runs. Are you sure you want to leave?":"You have unsaved changes. Are you sure you want to leave?"})]},"playground-content")}function fT(){const{instanceWithPrompt:n,templateFormat:a}=Me(),{instance:l}=m.useMemo(()=>{const{instance:t}=co();return{instance:{...t,...n,template:n.template}}},[n]);return e(Ji,{instances:[l],templateFormat:a})}const Cu=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"},{defaultValue:null,kind:"LocalArgument",name:"promptId"}],a=[{kind:"Variable",name:"input",variableName:"input"}],l=[{kind:"Variable",name:"id",variableName:"promptId"}],t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"TagPromptVersionButtonSetTagMutation",selections:[{alias:null,args:a,concreteType:"PromptVersionTagMutationPayload",kind:"LinkedField",name:"setPromptVersionTag",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:"prompt",args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[{args:null,kind:"FragmentSpread",name:"PromptVersionsList__main"}],type:"Prompt",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"TagPromptVersionButtonSetTagMutation",selections:[{alias:null,args:a,concreteType:"PromptVersionTagMutationPayload",kind:"LinkedField",name:"setPromptVersionTag",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:"prompt",args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptVersionConnection",kind:"LinkedField",name:"promptVersions",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"node",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Prompt",abstractKey:null},t],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"991a6a38de992c1261cceafe9b2c6850",id:null,metadata:{},name:"TagPromptVersionButtonSetTagMutation",operationKind:"mutation",text:`mutation TagPromptVersionButtonSetTagMutation(
|
|
3481
3481
|
$input: SetPromptVersionTagInput!
|
|
3482
3482
|
$promptId: ID!
|
|
3483
3483
|
) {
|
|
@@ -3570,7 +3570,7 @@ fragment PromptVersionTagsList_data on PromptVersion {
|
|
|
3570
3570
|
name
|
|
3571
3571
|
}
|
|
3572
3572
|
}
|
|
3573
|
-
`}}}();Ku.hash="a6e4352854be2ab5fd0c10368a3469ad";function Sv({onNewTagCreated:n,promptVersionId:a,onDismiss:l}){const{control:t,handleSubmit:i,formState:{isDirty:r}}=Ve({defaultValues:{name:"",description:""}}),[s,d]=m.useState(null),[c,p]=x.useMutation(Ku);return e(re,{onDismiss:l,isDismissable:!0,type:"modal",children:o(te,{title:"New Prompt Tag",children:[s?e(Fe,{variant:"danger",banner:!0,children:s}):null,o(Ye,{onSubmit:i(u=>{d(null),c({variables:{input:{name:u.name,description:u.description,promptVersionId:a},promptVersionId:a},onCompleted:()=>{n(u),l()},onError:g=>{d(g.message)}})}),children:[o(v,{padding:"size-200",children:[e(H,{name:"name",control:t,rules:{required:"Name is required",pattern:yu},render:({field:{name:u,onChange:g,onBlur:f,value:k},fieldState:{invalid:h,error:S}})=>o(X,{isInvalid:h,onChange:g,onBlur:f,name:u,value:k.toString(),children:[e(G,{children:"Tag Name"}),e(Z,{placeholder:"e.x. prod"}),S!=null&&S.message?e(Se,{children:S.message}):e(C,{slot:"description",children:"The identifier of the tag"})]})}),e(H,{name:"description",control:t,render:({field:{name:u,onChange:g,onBlur:f,value:k},fieldState:{invalid:h,error:S}})=>o(X,{isInvalid:h,onChange:g,name:u,onBlur:f,value:k.toString(),children:[e(G,{children:"Description"}),e(fa,{placeholder:"A description of the tag"}),S!=null&&S.message?e(Se,{children:S.message}):e(C,{slot:"description",children:"A description of the tag (optional)"})]})})]}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopColor:"dark",borderTopWidth:"thin",children:e(b,{gap:"size-100",justifyContent:"end",children:e(E,{variant:r?"primary":"default",size:"S",type:"submit",isDisabled:p,children:"Create Tag"})})})]})]})})}function vv(){const[n,a]=m.useState(!1),[l,t]=m.useState(0),i=me(),{promptId:r,versionId:s}=Oe();if(!r)throw new Error("Expected promptId to be defined");if(!s)throw new Error("Expected versionId to be defined");return o("div",{children:[o(
|
|
3573
|
+
`}}}();Ku.hash="a6e4352854be2ab5fd0c10368a3469ad";function Sv({onNewTagCreated:n,promptVersionId:a,onDismiss:l}){const{control:t,handleSubmit:i,formState:{isDirty:r}}=Ve({defaultValues:{name:"",description:""}}),[s,d]=m.useState(null),[c,p]=x.useMutation(Ku);return e(re,{onDismiss:l,isDismissable:!0,type:"modal",children:o(te,{title:"New Prompt Tag",children:[s?e(Fe,{variant:"danger",banner:!0,children:s}):null,o(Ye,{onSubmit:i(u=>{d(null),c({variables:{input:{name:u.name,description:u.description,promptVersionId:a},promptVersionId:a},onCompleted:()=>{n(u),l()},onError:g=>{d(g.message)}})}),children:[o(v,{padding:"size-200",children:[e(H,{name:"name",control:t,rules:{required:"Name is required",pattern:yu},render:({field:{name:u,onChange:g,onBlur:f,value:k},fieldState:{invalid:h,error:S}})=>o(X,{isInvalid:h,onChange:g,onBlur:f,name:u,value:k.toString(),children:[e(G,{children:"Tag Name"}),e(Z,{placeholder:"e.x. prod"}),S!=null&&S.message?e(Se,{children:S.message}):e(C,{slot:"description",children:"The identifier of the tag"})]})}),e(H,{name:"description",control:t,render:({field:{name:u,onChange:g,onBlur:f,value:k},fieldState:{invalid:h,error:S}})=>o(X,{isInvalid:h,onChange:g,name:u,onBlur:f,value:k.toString(),children:[e(G,{children:"Description"}),e(fa,{placeholder:"A description of the tag"}),S!=null&&S.message?e(Se,{children:S.message}):e(C,{slot:"description",children:"A description of the tag (optional)"})]})})]}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopColor:"dark",borderTopWidth:"thin",children:e(b,{gap:"size-100",justifyContent:"end",children:e(E,{variant:r?"primary":"default",size:"S",type:"submit",isDisabled:p,children:"Create Tag"})})})]})]})})}function vv(){const[n,a]=m.useState(!1),[l,t]=m.useState(0),i=me(),{promptId:r,versionId:s}=Oe();if(!r)throw new Error("Expected promptId to be defined");if(!s)throw new Error("Expected versionId to be defined");return o("div",{children:[o(Ue,{children:[e(E,{size:"S",leadingVisual:e(_,{svg:e(kf,{})}),children:"Tag Version"}),o(Oa,{placement:"bottom end",children:[e(Qo,{}),o(pn,{children:[e(m.Suspense,{fallback:e(v,{padding:"size-100",children:e(ge,{size:"S"})}),children:e(Cv,{promptId:r,versionId:s,fetchKey:l,onTagSet:d=>{t(c=>c+1),i({title:"Tag Set",message:`The tag ${d} has been set on the version`})}})}),e(v,{padding:"size-100",width:"250px",children:e(E,{leadingVisual:e(_,{svg:e(da,{})}),size:"S",css:F`
|
|
3574
3574
|
width: 100%;
|
|
3575
3575
|
`,onPress:()=>a(!0),children:"New Tag"})})]})]})]}),n&&e(Sv,{promptVersionId:s,onDismiss:()=>a(!1),onNewTagCreated:d=>{t(c=>c+1),i({title:"Tag Created",message:`The tag ${d.name} has been created and been set on the version`})}})]})}function Cv({promptId:n,versionId:a,fetchKey:l,onTagSet:t}){var y,u;const i=x.useLazyLoadQuery(Fu,{promptId:n,versionId:a},{fetchKey:l,fetchPolicy:"store-and-network"}),r=m.useMemo(()=>{var g,f;return((f=(g=i==null?void 0:i.prompt)==null?void 0:g.versionTags)==null?void 0:f.map(k=>k.name))||[]},[(y=i==null?void 0:i.prompt)==null?void 0:y.versionTags]),s=m.useMemo(()=>{var g,f;return((f=(g=i==null?void 0:i.promptVersion)==null?void 0:g.tags)==null?void 0:f.map(k=>k.name))||[]},[(u=i==null?void 0:i.promptVersion)==null?void 0:u.tags]),d=m.useMemo(()=>Array.from(new Set([...mr.map(g=>g.name),...r])),[r]),[c,p]=x.useMutation(Cu);return e("ul",{children:d.map(g=>{const f=s.includes(g);return e("li",{children:e(v,{paddingY:"size-100",paddingX:"size-200",borderBottomColor:"light",borderBottomWidth:"thin",children:o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e("input",{type:"checkbox",name:g,checked:f,disabled:f||p,onChange:k=>{if(k.target.checked){const h=!s.includes(g);let S="";if(h){const K=mr.find(P=>P.name===g);S=(K==null?void 0:K.description)||""}c({variables:{input:{name:g,promptVersionId:a,description:S},promptId:n},onCompleted:()=>{t(g)}})}}}),e("span",{children:g})]})})},g)})})}function hT(){const n=Me();return je(n),e(Fv,{promptVersion:n.promptVersion})}function Fv({promptVersion:n}){return e(v,{width:"100%",overflow:"auto",elementType:"section",children:e(v,{padding:"size-200",width:"100%",overflow:"auto",children:o(b,{direction:"column",gap:"size-200",maxWidth:900,marginStart:"auto",marginEnd:"auto",children:[o(b,{direction:"row",justifyContent:"space-between",children:[o(b,{direction:"row",gap:"size-100",children:[e(ae,{level:2,children:`Version: ${n.id}`}),e(sc,{promptVersion:n})]}),o(b,{direction:"row",gap:"size-100",children:[e(de,{text:n.id,children:"Version ID"}),e(vv,{})]})]}),e(Yd,{promptVersion:n}),e(Ud,{promptVersion:n}),e(tc,{promptVersion:n})]})})})}const Tu=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"invocationParameters",storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"modelName",storageKey:null},d=[{alias:null,args:null,kind:"ScalarField",name:"definition",storageKey:null}],c={alias:null,args:null,concreteType:"ToolDefinition",kind:"LinkedField",name:"tools",plural:!0,selections:d,storageKey:null},p={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"toolCallId",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"promptVersionLoaderQuery",selections:[{alias:"promptVersion",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[{args:null,kind:"FragmentSpread",name:"PromptInvocationParameters__main"},{args:null,kind:"FragmentSpread",name:"PromptChatMessagesCard__main"},{args:null,kind:"FragmentSpread",name:"PromptCodeExportCard__main"},{args:null,kind:"FragmentSpread",name:"PromptModelConfigurationCard__main"},{args:null,kind:"FragmentSpread",name:"PromptVersionTagsList_data"},i,r,s,c,{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:[p],storageKey:null}],type:"PromptVersion",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"promptVersionLoaderQuery",selections:[{alias:"promptVersion",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[r,{alias:"provider",args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"template",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"PromptMessage",kind:"LinkedField",name:"messages",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"role",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"content",plural:!0,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TextContentValue",kind:"LinkedField",name:"text",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null}],storageKey:null}],type:"TextContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolCallContentValue",kind:"LinkedField",name:"toolCall",plural:!1,selections:[y,{alias:null,args:null,concreteType:"ToolCallFunction",kind:"LinkedField",name:"toolCall",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null},p],storageKey:null}],storageKey:null}],type:"ToolCallContentPart",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ToolResultContentValue",kind:"LinkedField",name:"toolResult",plural:!1,selections:[y,{alias:null,args:null,kind:"ScalarField",name:"result",storageKey:null}],storageKey:null}],type:"ToolResultContentPart",abstractKey:null}],storageKey:null}],storageKey:null}],type:"PromptChatTemplate",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"template",storageKey:null}],type:"PromptStringTemplate",abstractKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateType",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"templateFormat",storageKey:null},s,{alias:null,args:null,kind:"ScalarField",name:"modelProvider",storageKey:null},{alias:null,args:null,concreteType:"ResponseFormat",kind:"LinkedField",name:"responseFormat",plural:!1,selections:d,storageKey:null},c,{alias:"model",args:null,kind:"ScalarField",name:"modelName",storageKey:null},{alias:null,args:null,concreteType:"PromptVersionTag",kind:"LinkedField",name:"tags",plural:!0,selections:[t,p],storageKey:null},i],type:"PromptVersion",abstractKey:null}],storageKey:null}]},params:{cacheID:"4f37a4d04a5a5999d2f9f42875519473",id:null,metadata:{},name:"promptVersionLoaderQuery",operationKind:"query",text:`query promptVersionLoaderQuery(
|
|
3576
3576
|
$id: ID!
|
|
@@ -3909,7 +3909,7 @@ fragment AnnotationSummaryGroup on Span {
|
|
|
3909
3909
|
name
|
|
3910
3910
|
}
|
|
3911
3911
|
}
|
|
3912
|
-
`}}}();_u.hash="23916e656b7e054a82b1e1ac29e916d3";function Iv({spanNodeId:n,projectId:a,size:l="M",buttonText:t="Annotate"}){const[i,r]=m.useState(null);return o(J,{children:[e(E,{size:l,"aria-label":"Edit Span Annotations",leadingVisual:e(_,{svg:e(Sa,{})}),onPress:()=>r(e(jo,{spanNodeId:n,projectId:a})),children:t}),e(re,{type:"slideOver",isDismissable:!0,onDismiss:()=>r(null),children:i})]})}const Dv=n=>{const{json:a}=Qe(n);if(a==null||!ma(a))return null;const l=a[ve.user];if(l==null||!ma(l))return null;const t=l[Ap.id];return Tn.isString(t)||Tn.isNumber(t)?t:null};function Br({role:n,value:a,mimeType:l}){const t=m.useMemo(()=>{if(l!=="json")return String(a);const r=Qe(a);return r.json==null?"--":JSON.stringify(r.json,null,2)},[a,l]),i=Dl(n==="HUMAN"?"user":"assistant");return e(v,{alignSelf:n==="HUMAN"?"start":"end",borderRadius:"medium",borderColor:"dark",borderWidth:"thin",padding:"size-200",maxWidth:"70%",...i,children:o(b,{direction:"column",gap:"size-50",children:[e(C,{color:"text-700",children:n}),l==="json"?e(
|
|
3912
|
+
`}}}();_u.hash="23916e656b7e054a82b1e1ac29e916d3";function Iv({spanNodeId:n,projectId:a,size:l="M",buttonText:t="Annotate"}){const[i,r]=m.useState(null);return o(J,{children:[e(E,{size:l,"aria-label":"Edit Span Annotations",leadingVisual:e(_,{svg:e(Sa,{})}),onPress:()=>r(e(jo,{spanNodeId:n,projectId:a})),children:t}),e(re,{type:"slideOver",isDismissable:!0,onDismiss:()=>r(null),children:i})]})}const Dv=n=>{const{json:a}=Qe(n);if(a==null||!ma(a))return null;const l=a[ve.user];if(l==null||!ma(l))return null;const t=l[Ap.id];return Tn.isString(t)||Tn.isNumber(t)?t:null};function Br({role:n,value:a,mimeType:l}){const t=m.useMemo(()=>{if(l!=="json")return String(a);const r=Qe(a);return r.json==null?"--":JSON.stringify(r.json,null,2)},[a,l]),i=Dl(n==="HUMAN"?"user":"assistant");return e(v,{alignSelf:n==="HUMAN"?"start":"end",borderRadius:"medium",borderColor:"dark",borderWidth:"thin",padding:"size-200",maxWidth:"70%",...i,children:o(b,{direction:"column",gap:"size-50",children:[e(C,{color:"text-700",children:n}),l==="json"?e(hn,{value:t}):e(C,{children:t})]})})}function Lv({traceId:n,rootSpan:a,index:l}){const t=m.useMemo(()=>new Date(a.startTime),[a.startTime]),i=m.useMemo(()=>Dv(a.attributes),[a.attributes]);return e(v,{height:"100%",children:o(b,{direction:"column",justifyContent:"space-between",height:"100%",children:[o(b,{direction:"column",gap:"size-200",children:[o(b,{direction:"row",justifyContent:"space-between",children:[o(C,{children:["Trace #",l+1]}),e(we,{to:`/projects/${a.project.id}/traces/${n}?${un}=${a.id}`,children:o(b,{alignItems:"center",children:["View Trace",e(_,{svg:e(bf,{})})]})})]}),o(b,{direction:"row",justifyContent:"space-between",children:[i!=null?o(C,{color:"text-700",children:["user: ",i]}):null,e(C,{color:"text-700",flex:"end",marginStart:"auto",children:Jn(t)})]}),o(b,{direction:"row",gap:"size-100",children:[e(va,{tokenCountTotal:a.cumulativeTokenCountTotal??0,nodeId:a.id}),a.latencyMs!=null?e($e,{latencyMs:a.latencyMs}):"--"]})]}),o(b,{direction:"row",justifyContent:"space-between",alignItems:"end",children:[o(b,{direction:"column",gap:"size-100",maxWidth:"50%",children:[e(C,{children:"Feedback"}),e(b,{gap:"size-50",direction:"column",children:e(ut,{span:a,renderEmptyState:()=>"--"})})]}),e("span",{children:e(Iv,{size:"S",spanNodeId:a.id,projectId:a.project.id,buttonText:"Annotate"})})]})]})})}function _v({rootSpan:n}){var a,l,t,i;return o(b,{direction:"column",gap:"size-100",children:[e(Br,{role:"HUMAN",value:(a=n.input)==null?void 0:a.value,mimeType:(l=n.input)==null?void 0:l.mimeType}),e(Br,{role:"AI",value:(t=n.output)==null?void 0:t.value,mimeType:(i=n.output)==null?void 0:i.mimeType})]})}function Av({traces:n}){const a=m.useMemo(()=>((n==null?void 0:n.edges)||[]).map(({trace:t})=>t).filter(t=>t.rootSpan!==null),[n]);return e(v,{height:"100%",flex:"1 1 auto",overflow:"auto",children:a.map(({traceId:l,rootSpan:t},i)=>e(v,{borderBottomColor:"dark",borderBottomWidth:"thin",children:o(b,{direction:"row",children:[e(v,{borderRightWidth:"thin",borderEndColor:"dark",padding:"size-200",flex:"1 1 auto",children:e(_v,{rootSpan:t})}),e(v,{width:350,padding:"size-200",flex:"none",children:e(Lv,{traceId:l,rootSpan:t,index:i})})]})},t.spanId))})}function wv({traceCount:n,tokenUsage:a,latencyP50:l,sessionId:t}){return e(v,{padding:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",children:o(b,{direction:"row",gap:"size-400",children:[o(b,{direction:"column",children:[e(C,{elementType:"h3",color:"text-700",children:"Traces Count"}),e(C,{size:"L",children:n})]}),a!=null?o(b,{direction:"column",children:[e(C,{elementType:"h3",color:"text-700",children:"Total Tokens"}),e(va,{tokenCountTotal:a.total,nodeId:t,size:"L"})]}):null,l!=null?o(b,{direction:"column",children:[e(C,{elementType:"h3",color:"text-700",children:"Latency P50"}),e($e,{latencyMs:l,size:"L"})]}):null]})})}function Rv(n){const{sessionId:a}=n,l=x.useLazyLoadQuery(_u,{id:a},{fetchPolicy:"store-and-network"});if(l.session==null)throw new Error("Session not found");return o("main",{css:F`
|
|
3913
3913
|
flex: 1 1 auto;
|
|
3914
3914
|
display: flex;
|
|
3915
3915
|
flex-direction: column;
|
|
@@ -4368,7 +4368,7 @@ fragment MetricSelector_dimensions on Model {
|
|
|
4368
4368
|
padding: var(--ac-global-dimension-static-size-200);
|
|
4369
4369
|
white-space: normal;
|
|
4370
4370
|
margin: 0;
|
|
4371
|
-
`,children:n.text})]})})}function Xv({dimensions:n}){const a=m.useMemo(()=>n.map(i=>({name:i.dimension.name,type:i.dimension.type,value:i.value??"--"})),[n]),l=m.useMemo(()=>[{header:()=>"Name",accessorKey:"name"},{header:()=>"Type",accessorKey:"type"},{header:()=>"Value",accessorKey:"value"}],[]),t=Ke({columns:l,data:a,getCoreRowModel:Te()});return o("table",{css:
|
|
4371
|
+
`,children:n.text})]})})}function Xv({dimensions:n}){const a=m.useMemo(()=>n.map(i=>({name:i.dimension.name,type:i.dimension.type,value:i.value??"--"})),[n]),l=m.useMemo(()=>[{header:()=>"Name",accessorKey:"name"},{header:()=>"Type",accessorKey:"type"},{header:()=>"Value",accessorKey:"value"}],[]),t=Ke({columns:l,data:a,getCoreRowModel:Te()});return o("table",{css:He,children:[e("thead",{children:t.getHeaderGroups().map(i=>e("tr",{children:i.headers.map(r=>e("th",{colSpan:r.colSpan,children:r.isPlaceholder?null:e("div",{children:W(r.column.columnDef.header,r.getContext())})},r.id))},i.id))}),t.getCoreRowModel().rows.length?e("tbody",{children:t.getRowModel().rows.map(i=>e("tr",{children:i.getVisibleCells().map(r=>e("td",{children:W(r.column.columnDef.cell,r.getContext())},r.id))},i.id))}):e(nC,{})]})}function Yv({dataUrl:n}){const a=Cf(n),l=Ff(n);return a?e("video",{src:n,controls:!0,css:F`
|
|
4372
4372
|
width: 100%;
|
|
4373
4373
|
height: 500px;
|
|
4374
4374
|
background-color: black;
|
|
@@ -4445,7 +4445,7 @@ dataframe`,lC=F`
|
|
|
4445
4445
|
min-width: var(--grid-item-min-width);
|
|
4446
4446
|
height: var(--grid-item-height);
|
|
4447
4447
|
}
|
|
4448
|
-
`,children:l.map((p,y)=>{const u=i.get(p.id),{rawData:g=null,linkToData:f=null}=(u==null?void 0:u.embeddingMetadata)??{},{predictionLabel:k=null,actualLabel:h=null}=(u==null?void 0:u.eventMetadata)??{},S=Kf(p.id),K=a(S),P=r[p.id],I=s[P];return e("li",{children:e(Tf,{rawData:g,linkToData:f,inferencesName:K,group:P,onClick:()=>{t(p.id)},onMouseOver:()=>{c(p.id)},onMouseOut:()=>{c(null)},color:I,size:d,predictionLabel:k,actualLabel:h,promptAndResponse:p.promptAndResponse,documentText:p.documentText,autoPlay:!1})},y)})})})}function sC({data:n,onPointSelected:a}){const{primaryInferences:l,referenceInferences:t}=jn(),i=Y(y=>y.metric),[r,s]=m.useState([]),{columns:d,tableData:c}=m.useMemo(()=>{const y=n.filter(I=>I.id.includes("CORPUS")===!1);let u=!1,g=!1,f=!1,k=!1,h=!1;n.forEach(I=>{I.linkToData&&(u=!0),I.rawData&&(g=!0),(I.prompt||I.response)&&(f=!0),I.predictionLabel&&(k=!0),I.actualLabel&&(h=!0)});const S=[];t&&S.push({header:"Inference Set",accessorKey:"id",size:50,cell:({getValue:I})=>e(dC,{id:I(),primaryInferencesName:l.name,referenceInferencesName:(t==null?void 0:t.name)??"reference"})}),u&&S.push({header:"Link",accessorKey:"linkToData",cell:({getValue:I})=>{const D=I();if(typeof D=="string"){const T=D.split("/").pop();return e(Sn,{href:D,children:T})}return null}}),f?(S.push({header:"Prompt",accessorKey:"prompt",cell:Ee,size:200}),S.push({header:"Response",accessorKey:"response",cell:Ee,size:200})):g&&S.push({header:"Raw Data",accessorKey:"rawData"}),k&&S.push({header:"Prediction Label",accessorKey:"predictionLabel",size:50}),h&&S.push({header:"Actual Label",accessorKey:"actualLabel",size:50});const K=[];if(i&&i.type==="dataQuality"){const I=i.dimension.name;K.push({header:i.dimension.name,accessorKey:"metric",cell:Pf,sortingFn:"basic"}),y.forEach(D=>{var L;const T=(L=D.dimensions.find(V=>V.dimension.name===I))==null?void 0:L.value;D.metric=T!=null?Number(T):null})}return{columns:[...S,...K,{header:"",id:"view-details",size:50,cell:({row:I})=>e(E,{"aria-label":"view point details",size:"S",onPress:()=>{a(I.original.id)},children:"view details"})}],tableData:y}},[n,a,l,t,i]),p=Ke({columns:d,data:c,state:{sorting:r},getCoreRowModel:Te(),onSortingChange:s,getSortedRowModel:ln()});return o("table",{css:
|
|
4448
|
+
`,children:l.map((p,y)=>{const u=i.get(p.id),{rawData:g=null,linkToData:f=null}=(u==null?void 0:u.embeddingMetadata)??{},{predictionLabel:k=null,actualLabel:h=null}=(u==null?void 0:u.eventMetadata)??{},S=Kf(p.id),K=a(S),P=r[p.id],I=s[P];return e("li",{children:e(Tf,{rawData:g,linkToData:f,inferencesName:K,group:P,onClick:()=>{t(p.id)},onMouseOver:()=>{c(p.id)},onMouseOut:()=>{c(null)},color:I,size:d,predictionLabel:k,actualLabel:h,promptAndResponse:p.promptAndResponse,documentText:p.documentText,autoPlay:!1})},y)})})})}function sC({data:n,onPointSelected:a}){const{primaryInferences:l,referenceInferences:t}=jn(),i=Y(y=>y.metric),[r,s]=m.useState([]),{columns:d,tableData:c}=m.useMemo(()=>{const y=n.filter(I=>I.id.includes("CORPUS")===!1);let u=!1,g=!1,f=!1,k=!1,h=!1;n.forEach(I=>{I.linkToData&&(u=!0),I.rawData&&(g=!0),(I.prompt||I.response)&&(f=!0),I.predictionLabel&&(k=!0),I.actualLabel&&(h=!0)});const S=[];t&&S.push({header:"Inference Set",accessorKey:"id",size:50,cell:({getValue:I})=>e(dC,{id:I(),primaryInferencesName:l.name,referenceInferencesName:(t==null?void 0:t.name)??"reference"})}),u&&S.push({header:"Link",accessorKey:"linkToData",cell:({getValue:I})=>{const D=I();if(typeof D=="string"){const T=D.split("/").pop();return e(Sn,{href:D,children:T})}return null}}),f?(S.push({header:"Prompt",accessorKey:"prompt",cell:Ee,size:200}),S.push({header:"Response",accessorKey:"response",cell:Ee,size:200})):g&&S.push({header:"Raw Data",accessorKey:"rawData"}),k&&S.push({header:"Prediction Label",accessorKey:"predictionLabel",size:50}),h&&S.push({header:"Actual Label",accessorKey:"actualLabel",size:50});const K=[];if(i&&i.type==="dataQuality"){const I=i.dimension.name;K.push({header:i.dimension.name,accessorKey:"metric",cell:Pf,sortingFn:"basic"}),y.forEach(D=>{var L;const T=(L=D.dimensions.find(V=>V.dimension.name===I))==null?void 0:L.value;D.metric=T!=null?Number(T):null})}return{columns:[...S,...K,{header:"",id:"view-details",size:50,cell:({row:I})=>e(E,{"aria-label":"view point details",size:"S",onPress:()=>{a(I.original.id)},children:"view details"})}],tableData:y}},[n,a,l,t,i]),p=Ke({columns:d,data:c,state:{sorting:r},getCoreRowModel:Te(),onSortingChange:s,getSortedRowModel:ln()});return o("table",{css:He,children:[e("thead",{children:p.getHeaderGroups().map(y=>e("tr",{children:y.headers.map(u=>o("th",{children:[u.isPlaceholder?null:o("div",{className:u.column.getCanSort()?"cursor-pointer":"",onClick:u.column.getToggleSortingHandler(),children:[W(u.column.columnDef.header,u.getContext()),u.column.getIsSorted()?e(_,{className:"sort-icon",svg:u.column.getIsSorted()==="asc"?e(Je,{}):e(We,{})}):null]}),e("div",{onMouseDown:u.getResizeHandler(),onTouchStart:u.getResizeHandler(),className:`resizer ${u.column.getIsResizing()?"isResizing":""}`,style:{transform:u.column.getIsResizing()?`translateX(${p.getState().columnSizingInfo.deltaOffset}px)`:""}})]},u.id))},y.id))}),e("tbody",{children:p.getRowModel().rows.map(y=>e("tr",{children:y.getVisibleCells().map(u=>e("td",{style:{width:u.column.getSize()},children:W(u.column.columnDef.cell,u.getContext())},u.id))},y.id))})]})}function dC({id:n,primaryInferencesName:a,referenceInferencesName:l}){const t=n.includes("PRIMARY"),i=Ev();return o(b,{direction:"row",gap:"size-100",alignItems:"center",children:[e(If,{shape:xf.circle,color:i[t?0:1]}),t?a:l]})}const cC=F`
|
|
4449
4449
|
width: 100%;
|
|
4450
4450
|
height: 100%;
|
|
4451
4451
|
position: relative;
|
|
@@ -4937,7 +4937,7 @@ fragment DocumentEvaluationSummaryValueFragment_1dJL9N on Project {
|
|
|
4937
4937
|
}
|
|
4938
4938
|
id
|
|
4939
4939
|
}
|
|
4940
|
-
`}}}();bm.hash="6ec982057cc21ad195aa215a2118c5bc";function GC({evaluationName:n}){var i,r;const{projectId:a}=Oe(),{timeRange:l}=ct(),t=x.useLazyLoadQuery(bm,{id:a,evaluationName:n,timeRange:{start:(i=l==null?void 0:l.start)==null?void 0:i.toISOString(),end:(r=l==null?void 0:l.end)==null?void 0:r.toISOString()}});return o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:n}),e(m.Suspense,{fallback:e(C,{size:"L",children:"--"}),children:e(WC,{evaluationName:n,project:t==null?void 0:t.project})})]})}function WC(n){var p,y,u,g;const{project:a}=n,{fetchKey:l}=Ra(),[t,i]=x.useRefetchableFragment(km,a);m.useEffect(()=>{m.startTransition(()=>{i({},{fetchPolicy:"store-and-network"})})},[l,i]);const r=(p=t==null?void 0:t.documentEvaluationSummary)==null?void 0:p.averageNdcg,s=(y=t==null?void 0:t.documentEvaluationSummary)==null?void 0:y.averagePrecision,d=(u=t==null?void 0:t.documentEvaluationSummary)==null?void 0:u.hitRate,c=(g=t==null?void 0:t.documentEvaluationSummary)==null?void 0:g.meanReciprocalRank;return o(
|
|
4940
|
+
`}}}();bm.hash="6ec982057cc21ad195aa215a2118c5bc";function GC({evaluationName:n}){var i,r;const{projectId:a}=Oe(),{timeRange:l}=ct(),t=x.useLazyLoadQuery(bm,{id:a,evaluationName:n,timeRange:{start:(i=l==null?void 0:l.start)==null?void 0:i.toISOString(),end:(r=l==null?void 0:l.end)==null?void 0:r.toISOString()}});return o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:n}),e(m.Suspense,{fallback:e(C,{size:"L",children:"--"}),children:e(WC,{evaluationName:n,project:t==null?void 0:t.project})})]})}function WC(n){var p,y,u,g;const{project:a}=n,{fetchKey:l}=Ra(),[t,i]=x.useRefetchableFragment(km,a);m.useEffect(()=>{m.startTransition(()=>{i({},{fetchPolicy:"store-and-network"})})},[l,i]);const r=(p=t==null?void 0:t.documentEvaluationSummary)==null?void 0:p.averageNdcg,s=(y=t==null?void 0:t.documentEvaluationSummary)==null?void 0:y.averagePrecision,d=(u=t==null?void 0:t.documentEvaluationSummary)==null?void 0:u.hitRate,c=(g=t==null?void 0:t.documentEvaluationSummary)==null?void 0:g.meanReciprocalRank;return o(Le,{delay:0,placement:"bottom",children:[e(Ne,{children:e(b,{direction:"row",alignItems:"center",gap:"size-50",height:"28px",children:o(J,{children:[e(kn,{metric:"ndcg",score:r},"ndcg"),e(kn,{metric:"precision",score:s},"precision"),e(kn,{metric:"hit rate",score:d},"hit")]})})}),e(Hn,{children:e(v,{width:"size-2400",children:o(b,{direction:"column",children:[o(b,{justifyContent:"space-between",children:[e(C,{children:"average ndcg"}),e(C,{children:typeof r=="number"?za(r):"--"})]}),o(b,{justifyContent:"space-between",children:[e(C,{children:"average precision"}),e(C,{children:typeof s=="number"?za(s):"--"})]}),o(b,{justifyContent:"space-between",children:[e(C,{children:"mean reciprocal rank"}),e(C,{children:typeof c=="number"?za(c):"--"})]}),o(b,{justifyContent:"space-between",children:[e(C,{children:"hit rate"}),e(C,{children:typeof d=="number"?za(d):"--"})]})]})})})]})}function JC(n){var g;const{extra:a}=n,{fetchKey:l}=Ra(),[t,i]=x.useRefetchableFragment(fm,n.project);m.useEffect(()=>{m.startTransition(()=>{i({},{fetchPolicy:"store-and-network"})})},[l,i]);const r=t==null?void 0:t.latencyMsP50,s=t==null?void 0:t.latencyMsP99,d=t==null?void 0:t.tokenCountTotal,c=t==null?void 0:t.tokenCountPrompt,p=t==null?void 0:t.tokenCountCompletion,y=(g=t==null?void 0:t.spanAnnotationNames)==null?void 0:g.filter(f=>f!=="note"),u=t==null?void 0:t.documentEvaluationNames;return e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-200",paddingBottom:"size-50",flex:"none",children:o(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e("div",{css:F`
|
|
4941
4941
|
overflow-x: auto;
|
|
4942
4942
|
overflow-y: hidden;
|
|
4943
4943
|
flex: 1 1 auto;
|
|
@@ -4973,7 +4973,7 @@ fragment DocumentEvaluationSummaryValueFragment_1dJL9N on Project {
|
|
|
4973
4973
|
left center,
|
|
4974
4974
|
right center;
|
|
4975
4975
|
background-attachment: local, local, scroll, scroll;
|
|
4976
|
-
`,children:o(b,{direction:"row",gap:"size-400",alignItems:"center",children:[o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Total Traces"}),e(C,{size:"L",children:_a(t==null?void 0:t.traceCount)})]}),o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Total Tokens"}),o(
|
|
4976
|
+
`,children:o(b,{direction:"row",gap:"size-400",alignItems:"center",children:[o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Total Traces"}),e(C,{size:"L",children:_a(t==null?void 0:t.traceCount)})]}),o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Total Tokens"}),o(Le,{delay:0,placement:"bottom",children:[e(Ne,{children:e(C,{size:"L",children:_a(d)})}),e(Hn,{children:e(v,{width:"size-2400",children:o(b,{direction:"column",children:[o(b,{justifyContent:"space-between",children:[e(C,{children:"Prompt Tokens"}),e(C,{children:typeof c=="number"?wt(c):"--"})]}),o(b,{justifyContent:"space-between",children:[e(C,{children:"Completion Tokens"}),e(C,{children:typeof p=="number"?wt(p):"--"})]}),o(b,{justifyContent:"space-between",children:[e(C,{children:"Total Tokens"}),e(C,{children:typeof d=="number"?wt(d):"--"})]})]})})})]})]}),o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Latency P50"}),r!=null?e($e,{latencyMs:r,size:"L"}):e(C,{size:"L",children:"--"})]}),o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Latency P99"}),s!=null?e($e,{latencyMs:s,size:"L"}):e(C,{size:"L",children:"--"})]}),y.map(f=>e(gt,{fallback:jf,children:e(eb,{annotationName:f},f)},f)),u.map(f=>e(GC,{evaluationName:f},`document-${f}`))]})}),e(v,{flex:"none",paddingStart:"size-100",children:a})]})})}const Sm=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"StreamToggleRefetchQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"StreamToggle_data"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"StreamToggleRefetchQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"streamingLastUpdatedAt",storageKey:null}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"70bebe4abe808b13c94decf17c7cd90d",id:null,metadata:{},name:"StreamToggleRefetchQuery",operationKind:"query",text:`query StreamToggleRefetchQuery(
|
|
4977
4977
|
$id: ID!
|
|
4978
4978
|
) {
|
|
4979
4979
|
node(id: $id) {
|
|
@@ -5063,7 +5063,7 @@ fragment SessionsTable_sessions_2MhLSo on Project {
|
|
|
5063
5063
|
}
|
|
5064
5064
|
id
|
|
5065
5065
|
}
|
|
5066
|
-
`}}}();Km.hash="827cd1cd4207ee9d2803d2768d0a52ab";const Tm=function(){var n=["sessions"],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:null,kind:"LocalArgument",name:"filterIoSubstring"},{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:Km,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"SessionsTable_sessions",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:"sessions",args:[{kind:"Variable",name:"filterIoSubstring",variableName:"filterIoSubstring"},{kind:"Variable",name:"sort",variableName:"sort"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"ProjectSessionConnection",kind:"LinkedField",name:"__SessionsTable_sessions_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectSessionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"session",args:null,concreteType:"ProjectSession",kind:"LinkedField",name:"node",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"sessionId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"numTraces",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"firstInput",plural:!1,selections:l,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"lastOutput",plural:!1,selections:l,storageKey:null},{alias:null,args:null,concreteType:"TokenUsage",kind:"LinkedField",name:"tokenUsage",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"total",storageKey:null}],storageKey:null},{alias:"traceLatencyMsP50",args:[{kind:"Literal",name:"probability",value:.5}],kind:"ScalarField",name:"traceLatencyMsQuantile",storageKey:"traceLatencyMsQuantile(probability:0.5)"},{alias:"traceLatencyMsP99",args:[{kind:"Literal",name:"probability",value:.99}],kind:"ScalarField",name:"traceLatencyMsQuantile",storageKey:"traceLatencyMsQuantile(probability:0.99)"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"ProjectSession",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},a],type:"Project",abstractKey:null}}();Tm.hash="827cd1cd4207ee9d2803d2768d0a52ab";const Pm=m.createContext(null);function tF({children:n,...a}){const[l]=m.useState(()=>Of(a));return e(Pm.Provider,{value:l,children:n})}function
|
|
5066
|
+
`}}}();Km.hash="827cd1cd4207ee9d2803d2768d0a52ab";const Tm=function(){var n=["sessions"],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:null,kind:"LocalArgument",name:"filterIoSubstring"},{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:Km,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"SessionsTable_sessions",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:"sessions",args:[{kind:"Variable",name:"filterIoSubstring",variableName:"filterIoSubstring"},{kind:"Variable",name:"sort",variableName:"sort"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"ProjectSessionConnection",kind:"LinkedField",name:"__SessionsTable_sessions_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectSessionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"session",args:null,concreteType:"ProjectSession",kind:"LinkedField",name:"node",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"sessionId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"numTraces",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"firstInput",plural:!1,selections:l,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"lastOutput",plural:!1,selections:l,storageKey:null},{alias:null,args:null,concreteType:"TokenUsage",kind:"LinkedField",name:"tokenUsage",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"total",storageKey:null}],storageKey:null},{alias:"traceLatencyMsP50",args:[{kind:"Literal",name:"probability",value:.5}],kind:"ScalarField",name:"traceLatencyMsQuantile",storageKey:"traceLatencyMsQuantile(probability:0.5)"},{alias:"traceLatencyMsP99",args:[{kind:"Literal",name:"probability",value:.99}],kind:"ScalarField",name:"traceLatencyMsQuantile",storageKey:"traceLatencyMsQuantile(probability:0.99)"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"ProjectSession",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},a],type:"Project",abstractKey:null}}();Tm.hash="827cd1cd4207ee9d2803d2768d0a52ab";const Pm=m.createContext(null);function tF({children:n,...a}){const[l]=m.useState(()=>Of(a));return e(Pm.Provider,{value:l,children:n})}function Xe(n,a){const l=m.useContext(Pm);if(!l)throw new Error("Missing TracingContext.Provider in the tree");return Cl(l,n,a)}const iF=F`
|
|
5067
5067
|
flex: 1 1 auto;
|
|
5068
5068
|
.cm-content {
|
|
5069
5069
|
padding: var(--ac-global-dimension-static-size-100) 0;
|
|
@@ -5144,7 +5144,7 @@ messages = messages + [
|
|
|
5144
5144
|
response = assistant(
|
|
5145
5145
|
messages,
|
|
5146
5146
|
session_id=session_id,
|
|
5147
|
-
)`;function cF(){return o("div",{children:[e(v,{paddingTop:"size-200",paddingBottom:"size-100",children:e(ae,{level:2,weight:"heavy",children:"Install Dependencies"})}),e(v,{paddingBottom:"size-100",children:o(C,{children:["Sessions are tracked via the OpenTelemetry attribute ",e("b",{children:"session.id"}),". The easiest way to get started with sessions is to use the OpenInference instrumentation package."]})}),e(
|
|
5147
|
+
)`;function cF(){return o("div",{children:[e(v,{paddingTop:"size-200",paddingBottom:"size-100",children:e(ae,{level:2,weight:"heavy",children:"Install Dependencies"})}),e(v,{paddingBottom:"size-100",children:o(C,{children:["Sessions are tracked via the OpenTelemetry attribute ",e("b",{children:"session.id"}),". The easiest way to get started with sessions is to use the OpenInference instrumentation package."]})}),e(Ze,{children:e(Ln,{value:sF})}),e(v,{paddingTop:"size-200",paddingBottom:"size-100",children:e(ae,{level:2,weight:"heavy",children:"Add Session ID to your Traces"})}),e(v,{paddingBottom:"size-100",children:e(C,{children:"Below is an example of how to add session IDs to a simple OpenAI application."})}),e(Ze,{children:e(Ln,{value:dF})}),e(v,{paddingBottom:"size-100",paddingTop:"size-100",children:o(C,{children:["For more information on how to use sessions, consult the"," ",e(Sn,{href:"https://docs.arize.com/phoenix/tracing/how-to-tracing/setup-sessions",children:"documentation"})]})})]})}const uF="npm install @arizeai/openinference-core --save",mF=`import { trace } from "@opentelemetry/api";
|
|
5148
5148
|
import { SemanticConventions } from "@arizeai/openinference-semantic-conventions";
|
|
5149
5149
|
import { context } from "@opentelemetry/api";
|
|
5150
5150
|
import { setSession } from "@arizeai/openinference-core";
|
|
@@ -5204,7 +5204,7 @@ await assistant({
|
|
|
5204
5204
|
messages,
|
|
5205
5205
|
sessionId: sessionId,
|
|
5206
5206
|
});
|
|
5207
|
-
`;function gF(){return o("div",{children:[e(v,{paddingTop:"size-200",paddingBottom:"size-100",children:e(ae,{level:2,weight:"heavy",children:"Install Dependencies"})}),e(v,{paddingBottom:"size-100",children:o(C,{children:["Sessions are tracked via the OpenTelemetry attribute ",e("b",{children:"session.id"}),". The easiest way to get started with sessions is to use the OpenInference instrumentation package."]})}),e(
|
|
5207
|
+
`;function gF(){return o("div",{children:[e(v,{paddingTop:"size-200",paddingBottom:"size-100",children:e(ae,{level:2,weight:"heavy",children:"Install Dependencies"})}),e(v,{paddingBottom:"size-100",children:o(C,{children:["Sessions are tracked via the OpenTelemetry attribute ",e("b",{children:"session.id"}),". The easiest way to get started with sessions is to use the OpenInference instrumentation package."]})}),e(Ze,{children:e(Ln,{value:uF})}),e(v,{paddingTop:"size-200",paddingBottom:"size-100",children:e(ae,{level:2,weight:"heavy",children:"Add Session ID to your Traces"})}),e(v,{paddingBottom:"size-100",children:e(C,{children:"Below is an example of how to add session IDs to a simple OpenAI application."})}),e(Ze,{children:e(Xt,{value:mF})}),e(v,{paddingBottom:"size-100",children:o(C,{children:["For more information on how to use sessions, consult the"," ",e(Sn,{href:"https://docs.arize.com/phoenix/tracing/how-to-tracing/setup-sessions",children:"documentation"})]})})]})}function pF(){const[n,a]=m.useState("Python");return e(te,{title:"Setup Sessions for this Project",size:"L",children:o(v,{padding:"size-400",overflow:"auto",children:[e(v,{paddingBottom:"size-100",children:e(Pl,{language:n,onChange:a})}),n==="Python"?e(cF,{}):e(gF,{})]})})}function yF(){const[n,a]=m.useState(null),l=()=>{a(e(pF,{}))};return o("tbody",{className:"is-empty",children:[e("tr",{children:e("td",{colSpan:100,css:F`
|
|
5208
5208
|
text-align: center;
|
|
5209
5209
|
padding: var(--ac-global-dimension-size-300)
|
|
5210
5210
|
var(--ac-global-dimension-size-300) !important;
|
|
@@ -5221,10 +5221,10 @@ await assistant({
|
|
|
5221
5221
|
.ac-dropdown-button {
|
|
5222
5222
|
min-width: var(--ac-global-dimension-static-size-300);
|
|
5223
5223
|
}
|
|
5224
|
-
`,Jr=Ei,xm=({table:n})=>{const a=ce();return e("tbody",{children:n.getRowModel().rows.map(l=>e("tr",{onClick:()=>a(`${encodeURIComponent(l.id)}`),children:l.getVisibleCells().map(t=>e("td",{style:{width:`calc(var(--col-${t.column.id}-size) * 1px)`,maxWidth:`calc(var(--col-${t.column.id}-size) * 1px)`,textWrap:"nowrap",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W(t.column.columnDef.cell,t.getContext())},t.id))},l.id))})},fF=sn.memo(xm,(n,a)=>n.table.options.data===a.table.options.data);function hF(n){const a=m.useRef(null),[l,t]=m.useState([]),{filterIoSubstring:i}=Fm(),{fetchKey:r}=Ra(),{data:s,loadNext:d,hasNext:c,isLoadingNext:p,refetch:y}=x.usePaginationFragment(Tm,n.project),u=m.useMemo(()=>s.sessions.edges.map(({session:N})=>({...N,tokenCountTotal:N.tokenUsage.total})),[s.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:_e},{header:"end time",accessorKey:"endTime",enableSorting:!0,cell:_e},{header:"p50 latency",accessorKey:"traceLatencyMsP50",enableSorting:!1,cell:({getValue:N})=>{const j=N();return j===null||typeof j!="number"?null:e($e,{latencyMs:j})}},{header:"p99 latency",accessorKey:"traceLatencyMsP99",enableSorting:!1,cell:({getValue:N})=>{const j=N();return j===null||typeof j!="number"?null:e($e,{latencyMs:j})}},{header:"total tokens",accessorKey:"tokenCountTotal",enableSorting:!0,minSize:80,cell:({row:N,getValue:j})=>{const q=j();return q==null||typeof q!="number"?"--":e(va,{tokenCountTotal:q,nodeId:N.original.id})}},{header:"total traces",accessorKey:"numTraces",enableSorting:!0,cell:Xo}];m.useEffect(()=>{const N=l[0];m.startTransition(()=>{y({sort:N?{col:N.id,dir:N.desc?"desc":"asc"}:{col:"startTime",dir:"desc"},after:null,first:Jr,filterIoSubstring:i},{fetchPolicy:"store-and-network"})})},[l,y,i,r]);const f=sn.useCallback(N=>{if(N){const{scrollHeight:j,scrollTop:q,clientHeight:se}=N;j-q-se<300&&!p&&c&&d(Jr)}},[c,p,d]),[k,h]=m.useState({}),S=
|
|
5224
|
+
`,Jr=Ei,xm=({table:n})=>{const a=ce();return e("tbody",{children:n.getRowModel().rows.map(l=>e("tr",{onClick:()=>a(`${encodeURIComponent(l.id)}`),children:l.getVisibleCells().map(t=>e("td",{style:{width:`calc(var(--col-${t.column.id}-size) * 1px)`,maxWidth:`calc(var(--col-${t.column.id}-size) * 1px)`,textWrap:"nowrap",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W(t.column.columnDef.cell,t.getContext())},t.id))},l.id))})},fF=sn.memo(xm,(n,a)=>n.table.options.data===a.table.options.data);function hF(n){const a=m.useRef(null),[l,t]=m.useState([]),{filterIoSubstring:i}=Fm(),{fetchKey:r}=Ra(),{data:s,loadNext:d,hasNext:c,isLoadingNext:p,refetch:y}=x.usePaginationFragment(Tm,n.project),u=m.useMemo(()=>s.sessions.edges.map(({session:N})=>({...N,tokenCountTotal:N.tokenUsage.total})),[s.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:_e},{header:"end time",accessorKey:"endTime",enableSorting:!0,cell:_e},{header:"p50 latency",accessorKey:"traceLatencyMsP50",enableSorting:!1,cell:({getValue:N})=>{const j=N();return j===null||typeof j!="number"?null:e($e,{latencyMs:j})}},{header:"p99 latency",accessorKey:"traceLatencyMsP99",enableSorting:!1,cell:({getValue:N})=>{const j=N();return j===null||typeof j!="number"?null:e($e,{latencyMs:j})}},{header:"total tokens",accessorKey:"tokenCountTotal",enableSorting:!0,minSize:80,cell:({row:N,getValue:j})=>{const q=j();return q==null||typeof q!="number"?"--":e(va,{tokenCountTotal:q,nodeId:N.original.id})}},{header:"total traces",accessorKey:"numTraces",enableSorting:!0,cell:Xo}];m.useEffect(()=>{const N=l[0];m.startTransition(()=>{y({sort:N?{col:N.id,dir:N.desc?"desc":"asc"}:{col:"startTime",dir:"desc"},after:null,first:Jr,filterIoSubstring:i},{fetchPolicy:"store-and-network"})})},[l,y,i,r]);const f=sn.useCallback(N=>{if(N){const{scrollHeight:j,scrollTop:q,clientHeight:se}=N;j-q-se<300&&!p&&c&&d(Jr)}},[c,p,d]),[k,h]=m.useState({}),S=Xe(N=>N.columnVisibility),K=Xe(N=>N.columnSizing),P=Xe(N=>N.setColumnSizing),I=Ke({columns:g,data:u,onExpandedChange:h,manualSorting:!0,state:{sorting:l,expanded:k,columnVisibility:S,columnSizing:K},columnResizeMode:"onChange",onColumnSizingChange:P,enableSubRowSelection:!1,onSortingChange:t,getCoreRowModel:Te(),getSortedRowModel:ln(),getExpandedRowModel:oo(),getRowId:N=>N.id}),T=I.getRowModel().rows.length===0,{columnSizingInfo:L,columnSizing:V}=I.getState(),w=I.getFlatHeaders,$=g.length,M=sn.useMemo(()=>{const N=w(),j={};for(let q=0;q<N.length;q++){const se=N[q];j[`--header-${se.id}-size`]=se.getSize(),j[`--col-${se.column.id}-size`]=se.column.getSize()}return j},[w,L,V,$]);return o("div",{css:Zi,children:[e(v,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:e(oF,{})}),e("div",{css:F`
|
|
5225
5225
|
flex: 1 1 auto;
|
|
5226
5226
|
overflow: auto;
|
|
5227
|
-
`,onScroll:N=>f(N.target),ref:a,children:o("table",{css:$n,style:{...M,width:I.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:I.getHeaderGroups().map(N=>e("tr",{children:N.headers.map(j=>e("th",{style:{width:`calc(var(--header-${j.id}-size) * 1px)`},children:j.isPlaceholder?null:o(J,{children:[o("div",{"data-sortable":j.column.getCanSort(),className:j.column.getCanSort()?"cursor-pointer":"",onClick:j.column.getToggleSortingHandler(),style:{left:j.getStart(),width:j.getSize()},children:[W(j.column.columnDef.header,j.getContext()),j.column.getIsSorted()?e(_,{className:"sort-icon",svg:j.column.getIsSorted()==="asc"?e(
|
|
5227
|
+
`,onScroll:N=>f(N.target),ref:a,children:o("table",{css:$n,style:{...M,width:I.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:I.getHeaderGroups().map(N=>e("tr",{children:N.headers.map(j=>e("th",{style:{width:`calc(var(--header-${j.id}-size) * 1px)`},children:j.isPlaceholder?null:o(J,{children:[o("div",{"data-sortable":j.column.getCanSort(),className:j.column.getCanSort()?"cursor-pointer":"",onClick:j.column.getToggleSortingHandler(),style:{left:j.getStart(),width:j.getSize()},children:[W(j.column.columnDef.header,j.getContext()),j.column.getIsSorted()?e(_,{className:"sort-icon",svg:j.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]}),e("div",{onMouseDown:j.getResizeHandler(),onTouchStart:j.getResizeHandler(),className:`resizer ${j.column.getIsResizing()?"isResizing":""}`})]})},j.id))},N.id))}),T?e(yF,{}):L.isResizingColumn?e(fF,{table:I}):e(xm,{table:I})]})})]})}function Xi({children:n}){const{projectId:a}=Oe();if(!a)throw new Error("projectId is required");const{tab:l}=It();if(!Sd(l))throw new Error(`Invalid tab: ${l}`);return e(tF,{projectId:a,tableId:l||"table",children:n})}function kF({queryReference:n}){const a=x.usePreloadedQuery(Ad,n);return e(lF,{children:e(hF,{project:a.project})})}const AT=()=>{const{sessionsQueryReference:n}=Ct();return n?o(Xi,{children:[e(Ui,{children:e(m.Suspense,{fallback:e(ge,{}),children:e(kF,{queryReference:n})})}),e(m.Suspense,{children:e(Ce,{})})]}):null},Im=function(){var n={defaultValue:null,kind:"LocalArgument",name:"after"},a={defaultValue:null,kind:"LocalArgument",name:"filterCondition"},l={defaultValue:30,kind:"LocalArgument",name:"first"},t={defaultValue:null,kind:"LocalArgument",name:"id"},i={defaultValue:null,kind:"LocalArgument",name:"orphanSpanAsRootSpan"},r={defaultValue:!0,kind:"LocalArgument",name:"rootSpansOnly"},s={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"},y={kind:"Variable",name:"filterCondition",variableName:"filterCondition"},u={kind:"Variable",name:"first",variableName:"first"},g={kind:"Variable",name:"rootSpansOnly",variableName:"rootSpansOnly"},f={kind:"Variable",name:"sort",variableName:"sort"},k={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},K=[p,y,u,{kind:"Variable",name:"orphanSpanAsRootSpan",variableName:"orphanSpanAsRootSpan"},g,f,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],P=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],I={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},D={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r,s,d],kind:"Fragment",metadata:null,name:"SpansTableSpansQuery",selections:[{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:[p,y,u,g,f],kind:"FragmentSpread",name:"SpansTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,a,l,i,r,s,d,t],kind:"Operation",name:"SpansTableSpansQuery",selections:[{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[k,h,{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:[h,{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:"cumulativeTokenCountTotal",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:[h,{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:P,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:P,storageKey:null},{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[h,S,I,D,{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},h],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummaries",plural:!0,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null},I],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null},S],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},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[h,{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[k,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null}],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[h,S,{alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null},{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[I,D],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[h],type:"Node",abstractKey:"__isNode"}],storageKey:null}],storageKey:null}],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,h],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:"fc79d02f18fbddd3427e6290828530b7",id:null,metadata:{},name:"SpansTableSpansQuery",operationKind:"query",text:`query SpansTableSpansQuery(
|
|
5228
5228
|
$after: String = null
|
|
5229
5229
|
$filterCondition: String = null
|
|
5230
5230
|
$first: Int = 30
|
|
@@ -5375,8 +5375,8 @@ fragment SpansTable_spans_xYL0c on Project {
|
|
|
5375
5375
|
}
|
|
5376
5376
|
max-width: 100%;
|
|
5377
5377
|
height: var(--ac-global-dimension-size-200);
|
|
5378
|
-
`;function SF({metadata:n,onClick:a}){const l=m.useMemo(()=>{let t=n;return t.startsWith("{")&&(t=t.slice(1)),t.endsWith("}")&&(t=t.slice(0,-1)),t},[n]);return e("div",{css:F(bF),role:a?"button":"label","aria-label":"metadata",onClick:t=>{t.stopPropagation(),t.preventDefault(),a==null||a()},children:e(b,{direction:"row",justifyContent:"space-between",alignItems:"center",height:"100%",children:e(
|
|
5379
|
-
`,"\\n").replaceAll('"','\\"')}function CF(n){return typeof n=="boolean"?n?"True":"False":typeof n=="number"?n.toString():typeof n=="string"?`"${vF(n)}"`:""}const Lm=(n,a)=>`metadata${n.split(".").map(i=>/^\d+$/.test(i)?`[${i}]`:`['${i}']`).join("")} == ${CF(a)}`;function FF({children:n,metadata:a,width:l}){const{appendFilterCondition:t}=xt(),i=Object.entries(a).map(([r,s])=>({key:r,value:String(s),filterCondition:Lm(r,s)}));return o(
|
|
5378
|
+
`;function SF({metadata:n,onClick:a}){const l=m.useMemo(()=>{let t=n;return t.startsWith("{")&&(t=t.slice(1)),t.endsWith("}")&&(t=t.slice(0,-1)),t},[n]);return e("div",{css:F(bF),role:a?"button":"label","aria-label":"metadata",onClick:t=>{t.stopPropagation(),t.preventDefault(),a==null||a()},children:e(b,{direction:"row",justifyContent:"space-between",alignItems:"center",height:"100%",children:e(dn,{maxWidth:"100%",children:e(C,{children:l})})})})}function vF(n){return n.replaceAll(`
|
|
5379
|
+
`,"\\n").replaceAll('"','\\"')}function CF(n){return typeof n=="boolean"?n?"True":"False":typeof n=="number"?n.toString():typeof n=="string"?`"${vF(n)}"`:""}const Lm=(n,a)=>`metadata${n.split(".").map(i=>/^\d+$/.test(i)?`[${i}]`:`['${i}']`).join("")} == ${CF(a)}`;function FF({children:n,metadata:a,width:l}){const{appendFilterCondition:t}=xt(),i=Object.entries(a).map(([r,s])=>({key:r,value:String(s),filterCondition:Lm(r,s)}));return o(Le,{delay:500,offset:3,children:[e(Ne,{children:n}),e(Hn,{UNSAFE_style:{minWidth:l},children:o(b,{direction:"row",wrap:"nowrap",gap:"size-100",children:[e(b,{flexBasis:"40%",children:o(b,{direction:"column",gap:"size-100",width:"100%",children:[e(C,{weight:"heavy",children:"Metadata"}),e("ul",{css:F`
|
|
5380
5380
|
display: flex;
|
|
5381
5381
|
flex-direction: column;
|
|
5382
5382
|
gap: var(--ac-global-dimension-size-100);
|
|
@@ -5384,7 +5384,7 @@ fragment SpansTable_spans_xYL0c on Project {
|
|
|
5384
5384
|
max-height: 200px;
|
|
5385
5385
|
scrollbar-gutter: stable;
|
|
5386
5386
|
padding-right: var(--ac-global-dimension-size-50);
|
|
5387
|
-
`,children:i.map(({key:r,value:s})=>e("li",{children:o(b,{direction:"row",gap:"size-100",children:[e(b,{flexBasis:"30%",width:0,children:e(
|
|
5387
|
+
`,children:i.map(({key:r,value:s})=>e("li",{children:o(b,{direction:"row",gap:"size-100",children:[e(b,{flexBasis:"30%",width:0,children:e(dn,{maxWidth:"100%",children:e(C,{weight:"heavy",color:"inherit",size:"XS",children:r})})}),e(b,{flexBasis:"70%",flexShrink:1,justifyContent:"end",width:0,children:e(dn,{maxWidth:"100%",children:e(C,{color:"inherit",size:"XS",maxWidth:"100%",children:s})})})]})},r))})]})}),e(v,{borderColor:"dark",paddingStart:"size-200",paddingEnd:"size-100",marginStart:"size-200",flexBasis:"60%",borderStartWidth:"thin",children:o(b,{direction:"column",gap:"size-100",width:"100%",children:[e(C,{weight:"heavy",children:"Filters"}),e("ul",{css:F`
|
|
5388
5388
|
display: flex;
|
|
5389
5389
|
flex-direction: row;
|
|
5390
5390
|
gap: var(--ac-global-dimension-size-100);
|
|
@@ -5402,7 +5402,7 @@ fragment SpansTable_spans_xYL0c on Project {
|
|
|
5402
5402
|
&:hover {
|
|
5403
5403
|
background-color: var(--ac-global-color-gray-300);
|
|
5404
5404
|
}
|
|
5405
|
-
`,children:["Match ",r]})},r))})]})})]})})]})}const _m=({metadata:n})=>{const{appendFilterCondition:a}=xt(),[l,t]=m.useMemo(()=>{try{if(typeof n!="string")throw new Error("Metadata is not a string");const i=Qf(n),r=JSON.stringify(i);if(Object.keys(i).length===0)throw new Error("Metadata is empty");return[i,r]}catch{return[null,null]}},[n]);return!l||!t?"--":e("div",{style:{maxWidth:"100%"},children:e(FF,{width:"800px",metadata:l,children:e(SF,{metadata:t,onClick:()=>{const[i,r]=Object.entries(l)[0],s=Lm(i,r);a(s)}})})})};function KF(){const n=yl(l=>l.treatOrphansAsRoots),a=yl(l=>l.setTreatOrphansAsRoots);return o(
|
|
5405
|
+
`,children:["Match ",r]})},r))})]})})]})})]})}const _m=({metadata:n})=>{const{appendFilterCondition:a}=xt(),[l,t]=m.useMemo(()=>{try{if(typeof n!="string")throw new Error("Metadata is not a string");const i=Qf(n),r=JSON.stringify(i);if(Object.keys(i).length===0)throw new Error("Metadata is empty");return[i,r]}catch{return[null,null]}},[n]);return!l||!t?"--":e("div",{style:{maxWidth:"100%"},children:e(FF,{width:"800px",metadata:l,children:e(SF,{metadata:t,onClick:()=>{const[i,r]=Object.entries(l)[0],s=Lm(i,r);a(s)}})})})};function KF(){const n=yl(l=>l.treatOrphansAsRoots),a=yl(l=>l.setTreatOrphansAsRoots);return o(Ue,{children:[e(E,{size:"M","aria-label":"Filter Configuration",leadingVisual:e(_,{svg:e(Bf,{})})}),o(Oa,{children:[e(Qo,{}),e(pn,{children:e(v,{padding:"size-100",children:e(b,{direction:"column",gap:"size-100",children:e(ha,{isSelected:n,onChange:l=>{a(l)},children:"Treat Orphan Spans as Roots"})})})})]})]})}function TF({projectName:n}){const[a,l]=m.useState("Python");return e(te,{title:"Send Traces to this Project",size:"L",children:o(v,{padding:"size-400",overflow:"auto",children:[e(v,{paddingBottom:"size-100",children:e(Pl,{language:a,onChange:l})}),a==="Python"?e(Yo,{projectName:n}):e(es,{projectName:n})]})})}function Am({projectName:n}){const[a,l]=m.useState(null),t=()=>{l(e(TF,{projectName:n}))};return o("tbody",{className:"is-empty",children:[e("tr",{children:e("td",{colSpan:100,css:F`
|
|
5406
5406
|
text-align: center;
|
|
5407
5407
|
padding: var(--ac-global-dimension-size-300)
|
|
5408
5408
|
var(--ac-global-dimension-size-300) !important;
|
|
@@ -5414,10 +5414,10 @@ fragment SpansTable_spans_xYL0c on Project {
|
|
|
5414
5414
|
align-items: center;
|
|
5415
5415
|
gap: var(--ac-global-dimension-static-size-100);
|
|
5416
5416
|
}
|
|
5417
|
-
`;function xF(n){const{columns:a}=n,l=
|
|
5417
|
+
`;function xF(n){const{columns:a}=n,l=Xe(c=>c.columnVisibility),t=Xe(c=>c.setColumnVisibility),i=m.useMemo(()=>a.filter(c=>!PF.includes(c.id)),[a]),r=m.useMemo(()=>i.every(c=>{const p=l[c.id];return p??!0}),[i,l]),s=m.useCallback(c=>{const{name:p,checked:y}=c.target;t({...l,[p]:y})},[l,t]),d=m.useCallback(c=>{const{checked:p}=c.target,y=i.reduce((u,g)=>({...u,[g.id]:p}),{});t(y)},[i,t]);return e("div",{css:F`
|
|
5418
5418
|
overflow-y: auto;
|
|
5419
5419
|
max-height: calc(100vh - 200px);
|
|
5420
|
-
`,children:o(v,{paddingTop:"size-50",paddingBottom:"size-50",children:[e(v,{borderBottomColor:"dark",borderBottomWidth:"thin",paddingBottom:"size-50",children:e("div",{css:Ul,children:o("label",{children:[e("input",{type:"checkbox",name:"toggle-all",checked:r,onChange:d}),"span columns"]})})}),e("ul",{children:i.map(c=>{const p=l[c.id],y=p??!0,u=typeof c.columnDef.header=="string"?c.columnDef.header:c.id;return e("li",{css:Ul,children:o("label",{children:[e("input",{type:"checkbox",name:c.id,checked:y,onChange:s}),u]})},c.id)})}),e(IF,{...n})]})})}function IF({query:n}){const a=x.useFragment(wm,n),l=
|
|
5420
|
+
`,children:o(v,{paddingTop:"size-50",paddingBottom:"size-50",children:[e(v,{borderBottomColor:"dark",borderBottomWidth:"thin",paddingBottom:"size-50",children:e("div",{css:Ul,children:o("label",{children:[e("input",{type:"checkbox",name:"toggle-all",checked:r,onChange:d}),"span columns"]})})}),e("ul",{children:i.map(c=>{const p=l[c.id],y=p??!0,u=typeof c.columnDef.header=="string"?c.columnDef.header:c.id;return e("li",{css:Ul,children:o("label",{children:[e("input",{type:"checkbox",name:c.id,checked:y,onChange:s}),u]})},c.id)})}),e(IF,{...n})]})})}function IF({query:n}){const a=x.useFragment(wm,n),l=Xe(s=>s.annotationColumnVisibility),t=Xe(s=>s.setAnnotationColumnVisibility),i=m.useMemo(()=>a.spanAnnotationNames.every(s=>l[s]||!1),[a.spanAnnotationNames,l]),r=m.useCallback(()=>{const s=a.spanAnnotationNames.reduce((d,c)=>({...d,[c]:!i}),{});t(s)},[a.spanAnnotationNames,t,i]);return o("section",{children:[e(v,{paddingTop:"size-50",paddingBottom:"size-50",borderColor:"dark",borderTopWidth:"thin",borderBottomWidth:"thin",children:e("div",{css:Ul,children:o("label",{children:[e("input",{type:"checkbox",name:"toggle-annotations-all",checked:i,onChange:r}),"annotations"]})})}),e("ul",{children:a.spanAnnotationNames.map(s=>{const d=l[s]??!1;return e("li",{css:Ul,children:o("label",{children:[e("input",{type:"checkbox",name:s,checked:d,onChange:()=>{t({...l,[s]:!d})}}),s]})},s)})})]})}const Em=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"condition"},{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"condition",variableName:"condition"}],concreteType:"ValidationResult",kind:"LinkedField",name:"validateSpanFilterCondition",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isValid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"errorMessage",storageKey:null}],storageKey:null}],type:"Project",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanFilterConditionFieldValidationQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanFilterConditionFieldValidationQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}]},params:{cacheID:"38e5e2288d5746b32b21632854cc7c82",id:null,metadata:{},name:"SpanFilterConditionFieldValidationQuery",operationKind:"query",text:`query SpanFilterConditionFieldValidationQuery(
|
|
5421
5421
|
$condition: String!
|
|
5422
5422
|
$id: ID!
|
|
5423
5423
|
) {
|
|
@@ -5473,7 +5473,7 @@ fragment SpansTable_spans_xYL0c on Project {
|
|
|
5473
5473
|
padding-left: var(--ac-global-dimension-static-size-100);
|
|
5474
5474
|
padding-right: var(--ac-global-dimension-static-size-100);
|
|
5475
5475
|
height: 100%;
|
|
5476
|
-
`,className:"button--reset",children:e(_,{svg:e(Nn,{})})})}),e(AF,{onAddFilterConditionSnippet:p})]})]}),o(
|
|
5476
|
+
`,className:"button--reset",children:e(_,{svg:e(Nn,{})})})}),e(AF,{onAddFilterConditionSnippet:p})]})]}),o(Le,{isOpen:k&&t,placement:"bottom",children:[e(Ne,{children:e("div",{})}),e(Hn,{children:r!=""?e(C,{color:"danger",children:r}):e(C,{color:"success",children:"Valid Expression"})})]})]})}function AF(n){const{onAddFilterConditionSnippet:a}=n;return e(v,{width:"500px",padding:"size-200",borderRadius:"medium",borderWidth:"thin",borderColor:"light",backgroundColor:"light",children:o(b,{direction:"column",gap:"size-100",children:[e(Pa,{label:"filter by kind",initialSnippet:"span_kind == 'LLM'",onAddFilterConditionSnippet:a},"kind"),e(Pa,{label:"filter by token count",initialSnippet:"cumulative_token_count.total > 1000",onAddFilterConditionSnippet:a},"token_count"),e(Pa,{label:"filter by annotation label",initialSnippet:"annotations['Hallucination'].label == 'hallucinated'",onAddFilterConditionSnippet:a},"annotation_label"),e(Pa,{label:"filter by evaluation label",initialSnippet:"evals['Hallucination'].label == 'hallucinated'",onAddFilterConditionSnippet:a},"eval_label"),e(Pa,{label:"filter by evaluation score",initialSnippet:"evals['Hallucination'].score < 1",onAddFilterConditionSnippet:a},"eval_score"),e(Pa,{label:"filter by metadata",initialSnippet:"metadata['topic'] == 'agent'",onAddFilterConditionSnippet:a},"metadata"),e(Pa,{label:"filter by substring",initialSnippet:"'agent' in input.value",onAddFilterConditionSnippet:a},"substring")]})})}function Pa(n){const{initialSnippet:a,onAddFilterConditionSnippet:l}=n,[t,i]=m.useState(a),{theme:r}=Xn(),s=r==="light"?Ca:Fa;return e(ba,{label:n.label,children:o(b,{direction:"row",width:"100%",gap:"size-100",children:[e("div",{css:F(Vm,F`
|
|
5477
5477
|
flex: 1 1 auto;
|
|
5478
5478
|
`),children:e(Ka,{value:t,basicSetup:{lineNumbers:!1,foldGutter:!1,bracketMatching:!0,syntaxHighlighting:!0,highlightActiveLine:!1,highlightActiveLineGutter:!1},extensions:[xl()],editable:!0,onChange:i,theme:s,css:Mm})}),e(E,{"aria-label":"Add to filter condition",variant:"default",onPress:()=>l(t),leadingVisual:e(_,{svg:e(Nn,{})})})]})})}const Nm=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"traceIds"}],a=[{alias:null,args:[{kind:"Variable",name:"traceIds",variableName:"traceIds"}],concreteType:"Query",kind:"LinkedField",name:"deleteTraces",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanSelectionToolbarDeleteTracesMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanSelectionToolbarDeleteTracesMutation",selections:a},params:{cacheID:"3e39d87554a43d8dc3006d3e977317e5",id:null,metadata:{},name:"SpanSelectionToolbarDeleteTracesMutation",operationKind:"mutation",text:`mutation SpanSelectionToolbarDeleteTracesMutation(
|
|
5479
5479
|
$traceIds: [ID!]!
|
|
@@ -5523,7 +5523,7 @@ fragment DatasetSelectorPopoverContent_datasets on Query {
|
|
|
5523
5523
|
height: 400px;
|
|
5524
5524
|
overflow-y: auto;
|
|
5525
5525
|
min-width: 300px;
|
|
5526
|
-
`,children:e(RF,{query:r,search:t,onDatasetSelected:l})})})]})}function RF(n){const{search:a,onDatasetSelected:l}=n,[t]=x.useRefetchableFragment(Om,n.query),i=m.useMemo(()=>{let s=t.datasets.edges.map(d=>d.dataset);return a&&(s=s.filter(d=>d.name.toLowerCase().includes(a.toLowerCase()))),s},[a,t]);return i.length===0?e(v,{padding:"size-200",children:e(b,{direction:"column",justifyContent:"center",alignItems:"center",flex:"1 1 auto",children:e(C,{children:"No datasets found"})})}):e(Yl,{selectionMode:"single",onSelectionChange:s=>{if(typeof s=="object"){const d=Array.from(s);l(d[0])}},children:i.map(s=>e(ue,{children:s.name},s.id))})}function Bm(n){const a=ce(),l=me(),t=ke(),[i,r]=m.useState(!1),[s,d]=m.useState(!1),[c,p]=m.useState(!1),{selectedSpans:y,onClearSelection:u}=n,[g,f]=x.useMutation($m),[k,h]=x.useMutation(Nm),S=y.length!==1,K=m.useCallback(D=>{g({variables:{input:{datasetId:D,spanIds:y.map(T=>T.id)}},onCompleted:()=>{l({title:"Examples added to dataset",message:`${y.length} example${S?"s have":" has"} been added to the dataset.`,action:{text:"View dataset",onClick:()=>{a(`/datasets/${D}/examples`)}}}),u()},onError:T=>{const L=
|
|
5526
|
+
`,children:e(RF,{query:r,search:t,onDatasetSelected:l})})})]})}function RF(n){const{search:a,onDatasetSelected:l}=n,[t]=x.useRefetchableFragment(Om,n.query),i=m.useMemo(()=>{let s=t.datasets.edges.map(d=>d.dataset);return a&&(s=s.filter(d=>d.name.toLowerCase().includes(a.toLowerCase()))),s},[a,t]);return i.length===0?e(v,{padding:"size-200",children:e(b,{direction:"column",justifyContent:"center",alignItems:"center",flex:"1 1 auto",children:e(C,{children:"No datasets found"})})}):e(Yl,{selectionMode:"single",onSelectionChange:s=>{if(typeof s=="object"){const d=Array.from(s);l(d[0])}},children:i.map(s=>e(ue,{children:s.name},s.id))})}function Bm(n){const a=ce(),l=me(),t=ke(),[i,r]=m.useState(!1),[s,d]=m.useState(!1),[c,p]=m.useState(!1),{selectedSpans:y,onClearSelection:u}=n,[g,f]=x.useMutation($m),[k,h]=x.useMutation(Nm),S=y.length!==1,K=m.useCallback(D=>{g({variables:{input:{datasetId:D,spanIds:y.map(T=>T.id)}},onCompleted:()=>{l({title:"Examples added to dataset",message:`${y.length} example${S?"s have":" has"} been added to the dataset.`,action:{text:"View dataset",onClick:()=>{a(`/datasets/${D}/examples`)}}}),u()},onError:T=>{const L=Ie(T);t({title:"An error occurred",message:`Failed to add spans to dataset: ${(L==null?void 0:L[0])??T.message}`})}})},[g,y,l,S,u,a,t]),P=m.useCallback(()=>{const D=[...new Set(y.map(T=>T.traceId))];k({variables:{traceIds:D},onCompleted:()=>{l({title:"Traces deleted",message:`${D.length} trace${D.length!==1?"s have":" has"} been deleted.`}),u()},onError:T=>{const L=Ie(T);t({title:"An error occurred",message:`Failed to delete traces: ${(L==null?void 0:L[0])??T.message}`})}})},[k,y,l,u,t]),I=()=>{p(!0)};return e("div",{css:F`
|
|
5527
5527
|
position: absolute;
|
|
5528
5528
|
bottom: var(--ac-global-dimension-size-600);
|
|
5529
5529
|
left: 50%;
|
|
@@ -5531,10 +5531,10 @@ fragment DatasetSelectorPopoverContent_datasets on Query {
|
|
|
5531
5531
|
z-index: 10;
|
|
5532
5532
|
box-shadow: 8px 8px 20px 0 rgba(0, 0, 0, 0.4);
|
|
5533
5533
|
border-radius: var(--ac-global-rounding-medium);
|
|
5534
|
-
`,children:e(v,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:o(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(C,{children:`${y.length} span${S?"s":""} selected`}),o(b,{direction:"row",gap:"size-100",children:[e(E,{variant:"default",size:"S",onPress:u,children:"Cancel"}),o(
|
|
5534
|
+
`,children:e(v,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:o(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(C,{children:`${y.length} span${S?"s":""} selected`}),o(b,{direction:"row",gap:"size-100",children:[e(E,{variant:"default",size:"S",onPress:u,children:"Cancel"}),o(Ue,{isOpen:s,onOpenChange:D=>{d(D)},children:[e(E,{variant:"default",size:"S",leadingVisual:f?e(en,{}):e(lt,{}),onPress:()=>{d(!0)},isDisabled:f,children:f?"Adding...":"Add to Dataset"}),e(m.Suspense,{children:e(Oa,{placement:"top end",crossOffset:300,children:e(wF,{onDatasetSelected:D=>{K(D),d(!1)},onCreateNewDataset:()=>{d(!1),r(!0)}})})})]}),e(Ue,{isOpen:i,onOpenChange:r,children:e(Oa,{children:e(yn,{children:e(pn,{children:o(Sl,{children:[o(kl,{children:[e(bl,{children:"New Dataset"}),e(mt,{children:e(E,{variant:"default",size:"S",onPress:()=>{r(!1)},leadingVisual:e(_,{svg:e(No,{})})})})]}),e(ns,{onDatasetCreateError:D=>{const T=Ie(D);t({title:"Dataset creation failed",message:`Failed to create dataset: ${(T==null?void 0:T[0])??D.message}`})},onDatasetCreated:D=>{r(!1),l({title:"Dataset created",message:`${D.name} has been successfully created.`}),d(!0)}})]})})})})}),e(E,{variant:"danger",size:"S",leadingVisual:e(_,{svg:h?e(en,{}):e(Ge,{})}),isDisabled:h,onPress:I,children:h?"Deleting...":"Delete"}),e(Ue,{isOpen:c,onOpenChange:p,children:e(yn,{children:e(pn,{children:o(Sl,{children:[e(kl,{children:e(bl,{children:"Delete Traces"})}),e(v,{padding:"size-200",children:e(C,{color:"danger",children:"Are you sure you want to delete the selected spans and their traces?"})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:o(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",onPress:()=>{p(!1)},children:"Cancel"}),e(E,{variant:"danger",onPress:()=>{P(),p(!1)},children:"Delete Traces"})]})})]})})})})]})]})})})}const qm="annotations",ai="-",Um={col:"startTime",dir:"desc"};function Hm(n){let a=null,l=null;if(n.id&&n.id.startsWith(qm)){const[,t,i]=n.id.split(ai);l={attr:t,name:i}}else a=n.id;return{col:a,evalResultKey:l,dir:n.desc?"desc":"asc"}}function Hl(n,a){return`${qm}${ai}${a}${ai}${n}`.replace(/[^a-zA-Z0-9]/g,"-")}const Vl=Ei,EF={minSize:100};function MF(n){return n==="root"||n==="all"}const Gm=({table:n,hasNext:a,onLoadNext:l,isLoadingNext:t})=>{const i=ce(),[r]=mn(),{traceId:s}=Oe(),d=r.get(un);return o("tbody",{children:[n.getRowModel().rows.map(c=>{const p=d===c.original.id||!d&&c.original.trace.traceId===s;return e("tr",{"data-selected":p,onClick:()=>i(`${c.original.trace.traceId}?${un}=${c.original.id}`),children:c.getVisibleCells().map(y=>{const u=`--col-${y.column.id}-size`;return e("td",{style:{width:`calc(var(${u}) * 1px)`,maxWidth:`calc(var(${u}) * 1px)`,textWrap:"nowrap",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:W(y.column.columnDef.cell,y.getContext())},y.id)})},c.id)}),a?e(Hf,{onLoadMore:l,isLoadingNext:t},"load-more"):null]})},VF=sn.memo(Gm,(n,a)=>n.table.options.data===a.table.options.data);function zF(n){const{fetchKey:a}=Ra(),l=m.useRef(null),t=m.useRef(!0),[i,r]=m.useState({}),[s,d]=m.useState([]),[c,p]=m.useState(""),[y,u]=m.useState(!0),g=Xe(A=>A.columnVisibility),{data:f,loadNext:k,hasNext:h,isLoadingNext:S,refetch:K}=x.usePaginationFragment(Dm,n.project),P=Gi(),I=P==null?void 0:P.setTraceSequence;m.useEffect(()=>{if(I)return I(f.spans.edges.map(({span:A})=>({traceId:A.trace.traceId,spanId:A.id}))),()=>{I([])}},[f.spans.edges,I]);const D=Xe(A=>A.annotationColumnVisibility),T=m.useMemo(()=>Object.keys(D).filter(A=>D[A]),[D]),L=m.useMemo(()=>f.spans.edges.map(({span:z})=>z),[f]),V=T.map(A=>({header:A,columns:[{header:"labels",accessorKey:Hl(A,"label"),cell:({row:z})=>{const U=z.original.spanAnnotationSummaries.find(ee=>ee.name===A);return U?e(Oc,{name:A,labelFractions:U.labelFractions}):null}},{header:"mean score",accessorKey:Hl(A,"score"),cell:({row:z})=>{const U=z.original.spanAnnotationSummaries.find(ee=>ee.name===A);return U?e(st,{value:U.meanScore,fallback:null}):null}}]})),w=[{header:()=>o(b,{direction:"row",gap:"size-50",children:[e("span",{children:"annotations"}),o(qa,{children:[e(ae,{level:3,weight:"heavy",children:"Annotations"}),e(ka,{children:"Evaluations and human annotations logged via the API or set via the UI."})]})]}),id:"annotations",accessorKey:"spanAnnotations",enableSorting:!1,cell:({row:A})=>o(b,{direction:"row",gap:"size-50",wrap:"wrap",children:[e(ut,{span:A.original,showFilterActions:!0}),A.original.documentRetrievalMetrics.map(z=>o(J,{children:[e(kn,{name:z.evaluationName,metric:"ndcg",score:z.ndcg},"ndcg"),e(kn,{name:z.evaluationName,metric:"precision",score:z.precision},"precision"),e(kn,{name:z.evaluationName,metric:"hit",score:z.hit},"hit")]}))]})},...V],$=[{id:"select",maxSize:10,header:({table:A})=>e(Mn,{checked:A.getIsAllRowsSelected(),indeterminate:A.getIsSomeRowsSelected(),onChange:A.getToggleAllRowsSelectedHandler()}),cell:({row:A})=>e(Mn,{checked:A.getIsSelected(),disabled:!A.getCanSelect(),indeterminate:A.getIsSomeSelected(),onChange:A.getToggleSelectedHandler()})},{header:"status",accessorKey:"statusCode",maxSize:30,enableSorting:!1,cell:({getValue:A})=>{const z=A();return e(b,{direction:"row",gap:"size-50",alignItems:"center",children:e(ot,{statusCode:z})})}},{header:"kind",accessorKey:"spanKind",maxSize:100,enableSorting:!1,cell:({getValue:A})=>e(vi,{spanKind:A()})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:A,row:z})=>{const U=z.original,{traceId:ee}=U.trace;return e(we,{to:`${ee}?${un}=${U.id}`,children:A()})}},{header:"input",accessorKey:"input.value",cell:Ee,enableSorting:!1},{header:"output",accessorKey:"output.value",cell:Ee,enableSorting:!1},{header:"metadata",accessorKey:"metadata",cell:({row:A})=>e(_m,{metadata:A.original.metadata}),enableSorting:!1},...w,{header:"start time",accessorKey:"startTime",cell:_e},{header:"latency",accessorKey:"latencyMs",cell:({getValue:A})=>{const z=A();return z===null||typeof z!="number"?null:e($e,{latencyMs:z})}},{header:y?"cumulative tokens":"total tokens",accessorKey:y?"cumulativeTokenCountTotal":"tokenCountTotal",cell:({row:A,getValue:z})=>{if(z()===null)return"--";const ee=A.original,rn=y?ee.cumulativeTokenCountTotal:ee.tokenCountTotal;return e(va,{tokenCountTotal:rn||0,nodeId:ee.id})}}];m.useEffect(()=>{if(t.current===!0){t.current=!1;return}m.startTransition(()=>{const A=s[0];K({sort:A?Hm(A):Um,after:null,first:Vl,filterCondition:c,rootSpansOnly:y},{fetchPolicy:"store-and-network"})})},[s,K,c,a,y]);const M=m.useCallback(A=>{if(A){const{scrollHeight:z,scrollTop:U,clientHeight:ee}=A;z-U-ee<300&&!S&&h&&k(Vl)}},[h,S,k]),N=Xe(A=>A.setColumnSizing),j=Xe(A=>A.columnSizing),q=Ke({columns:$,data:L,state:{sorting:s,columnVisibility:g,rowSelection:i,columnSizing:j},defaultColumn:EF,columnResizeMode:"onChange",manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:r,onSortingChange:d,onColumnSizingChange:N,getCoreRowModel:Te(),getSortedRowModel:ln()}),se=q.getRowModel().rows,be=q.getSelectedRowModel().rows,Qn=be.map(A=>({id:A.original.id,traceId:A.original.trace.id})),la=m.useCallback(()=>{r({})},[r]),el=se.length===0,Ta=q.getAllColumns().filter(A=>A.columns.length===0),{columnSizingInfo:Q,columnSizing:ie}=q.getState(),le=q.getFlatHeaders,Ae=Ta.length,[xe]=sn.useMemo(()=>{const A=le(),z={};for(let U=0;U<A.length;U++){const ee=A[U];z[`--header-${ee.id}-size`]=ee.getSize(),z[`--col-${ee.column.id}-size`]=ee.column.getSize()}return[z]},[le,Q,ie,Ae]);return o("div",{css:Zi,children:[e(v,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:o(b,{direction:"row",gap:"size-100",width:"100%",alignItems:"center",children:[e(zm,{onValidCondition:p}),o(yt,{"aria-label":"Toggle between root and all spans",selectionMode:"single",selectedKeys:[y?"root":"all"],onSelectionChange:A=>{if(A.size===0)return;const z=A.keys().next().value;if(MF(z))u(z==="root");else throw new Error(`Unknown root span filter selection: ${z}`)},children:[e(Fn,{"aria-label":"root spans",id:"root",children:"Root Spans"}),e(Fn,{"aria-label":"all spans",id:"all",children:"All"})]}),e(Rm,{columns:Ta,query:f}),e(KF,{})]})}),e("div",{css:F`
|
|
5535
5535
|
flex: 1 1 auto;
|
|
5536
5536
|
overflow: auto;
|
|
5537
|
-
`,onScroll:A=>M(A.target),ref:l,children:o("table",{css:$n,style:{...xe,width:q.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:q.getHeaderGroups().map(A=>e("tr",{children:A.headers.map(z=>e("th",{colSpan:z.colSpan,style:{width:`calc(var(--header-${z.id}-size) * 1px)`},children:z.isPlaceholder?null:o(J,{children:[o("div",{className:z.column.getCanSort()?"cursor-pointer":"",onClick:z.column.getToggleSortingHandler(),style:{left:z.getStart(),width:z.getSize()},children:[e(
|
|
5537
|
+
`,onScroll:A=>M(A.target),ref:l,children:o("table",{css:$n,style:{...xe,width:q.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:q.getHeaderGroups().map(A=>e("tr",{children:A.headers.map(z=>e("th",{colSpan:z.colSpan,style:{width:`calc(var(--header-${z.id}-size) * 1px)`},children:z.isPlaceholder?null:o(J,{children:[o("div",{className:z.column.getCanSort()?"cursor-pointer":"",onClick:z.column.getToggleSortingHandler(),style:{left:z.getStart(),width:z.getSize()},children:[e(dn,{maxWidth:"100%",children:W(z.column.columnDef.header,z.getContext())}),z.column.getIsSorted()?e(_,{className:"sort-icon",svg:z.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]}),e("div",{onMouseDown:z.getResizeHandler(),onTouchStart:z.getResizeHandler(),className:`resizer ${z.column.getIsResizing()?"isResizing":""}`})]})},z.id))},A.id))}),el?e(Am,{projectName:f.name}):Q.isResizingColumn?e(VF,{table:q,hasNext:h,onLoadNext:()=>k(Vl),isLoadingNext:S}):e(Gm,{table:q,hasNext:h,onLoadNext:()=>k(Vl),isLoadingNext:S})]})}),be.length?e(Bm,{selectedSpans:Qn,onClearSelection:la}):null]})}function NF({queryReference:n}){const a=x.usePreloadedQuery(_d,n);return e(zF,{project:a.project})}const wT=()=>{const{spansQueryReference:n}=Ct();return n?e(Xi,{children:o(nu,{children:[e(Ui,{children:e(m.Suspense,{fallback:e(ge,{}),children:e(NF,{queryReference:n})})}),e(m.Suspense,{children:e(Ce,{})})]})}):null},Wm=function(){var n={defaultValue:null,kind:"LocalArgument",name:"after"},a={defaultValue:null,kind:"LocalArgument",name:"filterCondition"},l={defaultValue:30,kind:"LocalArgument",name:"first"},t={defaultValue:null,kind:"LocalArgument",name:"id"},i={defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},r={defaultValue:null,kind:"LocalArgument",name:"timeRange"},s=[{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"},y={kind:"Variable",name:"sort",variableName:"sort"},u={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},k=[d,c,p,{kind:"Literal",name:"rootSpansOnly",value:!0},y,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],h={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},P={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},I=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],D={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:I,storageKey:null},T={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:I,storageKey:null},L={alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},V={alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},w={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},$={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},M={alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[g,f,w,$,{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},g],storageKey:null}],storageKey:null},N={alias:null,args:null,concreteType:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummaries",plural:!0,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null},w],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null},f],storageKey:null},j={alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[g,{alias:null,args:null,concreteType:"AnnotationConfigConnection",kind:"LinkedField",name:"annotationConfigs",plural:!1,selections:[{alias:null,args:null,concreteType:"AnnotationConfigEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[u,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"annotationType",storageKey:null}],type:"AnnotationConfigBase",abstractKey:"__isAnnotationConfigBase"},{kind:"InlineFragment",selections:[g,f,{alias:null,args:null,kind:"ScalarField",name:"optimizationDirection",storageKey:null},{alias:null,args:null,concreteType:"CategoricalAnnotationValue",kind:"LinkedField",name:"values",plural:!0,selections:[w,$],storageKey:null}],type:"CategoricalAnnotationConfig",abstractKey:null},{kind:"InlineFragment",selections:[g],type:"Node",abstractKey:"__isNode"}],storageKey:null}],storageKey:null}],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,l,t,i,r],kind:"Fragment",metadata:null,name:"TracesTableQuery",selections:[{alias:null,args:s,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:[d,c,p,y],kind:"FragmentSpread",name:"TracesTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,a,l,i,r,t],kind:"Operation",name:"TracesTableQuery",selections:[{alias:null,args:s,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[u,g,{kind:"InlineFragment",selections:[f,{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,h,f,{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},P,D,T,L,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[g,V,{alias:null,args:null,kind:"ScalarField",name:"numSpans",storageKey:null}],storageKey:null},M,N,j,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,h,f,{alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},S,K,P,{alias:"cumulativeTokenCountTotal",args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},D,T,L,{alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[g,V],storageKey:null},M,j,N,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:[u,g],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:"dcad31a9f81b32615240143982c91514",id:null,metadata:{},name:"TracesTableQuery",operationKind:"query",text:`query TracesTableQuery(
|
|
5538
5538
|
$after: String = null
|
|
5539
5539
|
$filterCondition: String = null
|
|
5540
5540
|
$first: Int = 30
|
|
@@ -5717,7 +5717,7 @@ fragment TracesTable_spans_1XEuU on Project {
|
|
|
5717
5717
|
&[data-is-additional-row="true"] {
|
|
5718
5718
|
box-shadow: inset 0 -10px 20px var(--ac-global-color-grey-100);
|
|
5719
5719
|
}
|
|
5720
|
-
`;function Xm(n){const{children:a}=n,l=[];for(const t of a){const i={...t.span,children:Xm({children:t.children})};l.push(i)}return l}function BF(n){const a=m.useRef(null),l=m.useRef(!0),[t,i]=m.useState({}),[r,s]=m.useState([]),[d,c]=m.useState(""),{fetchKey:p}=Ra(),{data:y,loadNext:u,hasNext:g,isLoadingNext:f,refetch:k}=x.usePaginationFragment(Jm,n.project),h=
|
|
5720
|
+
`;function Xm(n){const{children:a}=n,l=[];for(const t of a){const i={...t.span,children:Xm({children:t.children})};l.push(i)}return l}function BF(n){const a=m.useRef(null),l=m.useRef(!0),[t,i]=m.useState({}),[r,s]=m.useState([]),[d,c]=m.useState(""),{fetchKey:p}=Ra(),{data:y,loadNext:u,hasNext:g,isLoadingNext:f,refetch:k}=x.usePaginationFragment(Jm,n.project),h=Xe(A=>A.annotationColumnVisibility),S=m.useMemo(()=>Object.keys(h).filter(A=>h[A]),[h]),K=m.useMemo(()=>y.rootSpans.edges.map(({rootSpan:A})=>{const z=Gf([A,...A.descendants.edges.map(({node:rn})=>rn)]),[U]=Xm({children:z}),ee=A.trace.numSpans-$F-1;return ee>0&&(U.children=[...U.children,{...U,__additionalRow:!0,name:`+ ${ee} more span${ee>1?"s":""}`,id:`additional-${U.id}`,input:{value:""},output:{value:""},metadata:null,spanAnnotations:[],documentRetrievalMetrics:[],children:[]}]),U}),[y]),P=m.useMemo(()=>S.map(A=>({header:A,columns:[{header:"labels",accessorKey:Hl(A,"label"),cell:({row:z})=>{var ee;const U=(ee=z.original.spanAnnotationSummaries)==null?void 0:ee.find(rn=>rn.name===A);return U?e(Oc,{name:A,labelFractions:U.labelFractions}):null}},{header:"mean score",accessorKey:Hl(A,"score"),cell:({row:z})=>{var ee;const U=(ee=z.original.spanAnnotationSummaries)==null?void 0:ee.find(rn=>rn.name===A);return U?e(st,{value:U.meanScore,fallback:null}):null}}]})),[S]),I=m.useMemo(()=>[{header:()=>o(b,{direction:"row",gap:"size-50",children:[e("span",{children:"Annotations"}),o(qa,{children:[e(ae,{level:3,weight:"heavy",children:"Annotations"}),e(ka,{children:"Evaluations and human annotations logged via the API or set via the UI."})]})]}),id:"annotations",accessorKey:"spanAnnotations",enableSorting:!1,cell:({row:A})=>{if(A.original.__additionalRow)return null;const z=A.original.spanAnnotations.length===0&&A.original.documentRetrievalMetrics.length===0;return o(b,{direction:"row",gap:"size-50",wrap:"wrap",children:[e(ut,{span:A.original,showFilterActions:!0}),A.original.documentRetrievalMetrics.map(U=>o(m.Fragment,{children:[e(kn,{name:U.evaluationName,metric:"ndcg",score:U.ndcg},"ndcg"),e(kn,{name:U.evaluationName,metric:"precision",score:U.precision},"precision"),e(kn,{name:U.evaluationName,metric:"hit",score:U.hit},"hit")]},"doc-evals")),z?"--":null]})}},...P],[P]),D=m.useMemo(()=>[{id:"select",maxSize:10,header:({table:A})=>e(Mn,{checked:A.getIsAllRowsSelected(),indeterminate:A.getIsSomeRowsSelected(),onChange:A.getToggleAllRowsSelectedHandler()}),cell:({row:A})=>A.original.__additionalRow?null:e(Mn,{checked:A.getIsSelected(),disabled:!A.getCanSelect(),indeterminate:A.getIsSomeSelected(),onChange:A.getToggleSelectedHandler()})},{header:"status",accessorKey:"statusCode",maxSize:30,enableSorting:!1,cell:({getValue:A,row:z})=>{if(z.original.__additionalRow)return null;const U=A();return e(ot,{statusCode:U})}},{header:({table:A})=>o(b,{gap:"size-50",direction:"row",alignItems:"center",children:[e(fr,{isExpanded:A.getIsAllRowsExpanded(),onClick:A.getToggleAllRowsExpandedHandler(),"aria-label":"Expand all rows"}),"kind"]}),enableSorting:!1,accessorKey:"spanKind",maxSize:100,cell:A=>A.row.original.__additionalRow?e("div",{css:F`
|
|
5721
5721
|
// Since rows are flattened by default,
|
|
5722
5722
|
// we can use the row.depth property
|
|
5723
5723
|
// and paddingLeft to visually indicate the depth
|
|
@@ -5729,10 +5729,10 @@ fragment TracesTable_spans_1XEuU on Project {
|
|
|
5729
5729
|
// and paddingLeft to visually indicate the depth
|
|
5730
5730
|
// of the row
|
|
5731
5731
|
padding-left: ${A.row.depth*2}rem;
|
|
5732
|
-
`,children:o(b,{gap:"size-50",children:[A.row.getCanExpand()?e(fr,{isExpanded:A.row.getIsExpanded(),onClick:A.row.getToggleExpandedHandler(),"aria-label":"Expand row"}):null,e(vi,{spanKind:A.getValue()})]})})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:A,row:z})=>{const{traceId:U}=z.original.trace,ee=z.original.isAdditionalSpansRow?null:z.original.id;return e(we,{to:`${U}${ee?`?${
|
|
5732
|
+
`,children:o(b,{gap:"size-50",children:[A.row.getCanExpand()?e(fr,{isExpanded:A.row.getIsExpanded(),onClick:A.row.getToggleExpandedHandler(),"aria-label":"Expand row"}):null,e(vi,{spanKind:A.getValue()})]})})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:A,row:z})=>{const{traceId:U}=z.original.trace,ee=z.original.isAdditionalSpansRow?null:z.original.id;return e(we,{to:`${U}${ee?`?${un}=${ee}`:""}`,children:A()})}},{header:"input",accessorKey:"input.value",enableSorting:!1,cell:Ee},{header:"output",accessorKey:"output.value",enableSorting:!1,cell:Ee},{header:"metadata",accessorKey:"metadata",enableSorting:!1,cell:OF},...I,{header:"start time",accessorKey:"startTime",cell:A=>A.row.original.__additionalRow?null:e(_e,{...A})},{header:"latency",accessorKey:"latencyMs",cell:({getValue:A,row:z})=>{const U=A();return U===null||typeof U!="number"||z.original.__additionalRow?null:e($e,{latencyMs:U})}},{header:"total tokens",minSize:80,accessorKey:"cumulativeTokenCountTotal",cell:({row:A,getValue:z})=>{if(A.original.__additionalRow)return null;const U=z();return U===null?"--":e(va,{tokenCountTotal:U,nodeId:A.original.trace.id})}}],[I]);m.useEffect(()=>{if(l.current===!0){l.current=!1;return}const A=r[0];m.startTransition(()=>{k({sort:A?Hm(A):Um,after:null,first:Zr,filterCondition:d},{fetchPolicy:"store-and-network"})})},[r,k,d,p]);const T=m.useCallback(A=>{if(A){const{scrollHeight:z,scrollTop:U,clientHeight:ee}=A;z-U-ee<300&&!f&&g&&u(Zr)}},[g,f,u]),L=Gi(),V=L==null?void 0:L.setTraceSequence;m.useEffect(()=>{if(V)return V(y.rootSpans.edges.map(({rootSpan:A})=>({traceId:A.trace.traceId,spanId:A.id}))),()=>{V([])}},[y.rootSpans.edges,V]);const[w,$]=m.useState({}),M=Xe(A=>A.columnVisibility),N=Xe(A=>A.setColumnSizing),j=Xe(A=>A.columnSizing),q=Ke({columns:D,data:K,onExpandedChange:$,manualSorting:!0,getSubRows:A=>A.children,state:{sorting:r,expanded:w,columnVisibility:M,rowSelection:t,columnSizing:j},columnResizeMode:"onChange",onRowSelectionChange:i,enableSubRowSelection:!1,onSortingChange:s,onColumnSizingChange:N,getCoreRowModel:Te(),getSortedRowModel:ln(),getExpandedRowModel:oo(),getRowId:A=>A.id}),se=q.getRowModel().rows,be=q.getSelectedRowModel().flatRows,Qn=be.map(A=>({id:A.original.id,traceId:A.original.trace.id})),la=m.useCallback(()=>{i({})},[i]),el=se.length===0,Ta=q.getAllColumns().filter(A=>A.columns.length===0),{columnSizingInfo:Q,columnSizing:ie}=q.getState(),le=q.getFlatHeaders,Ae=Ta.length,xe=sn.useMemo(()=>{const A=le(),z={};for(let U=0;U<A.length;U++){const ee=A[U];z[`--header-${ee.id}-size`]=ee.getSize(),z[`--col-${ee.column.id}-size`]=ee.column.getSize()}return z},[le,Q,ie,Ae]);return o("div",{css:Zi,children:[e(v,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:o(b,{direction:"row",gap:"size-100",width:"100%",alignItems:"center",children:[e(zm,{onValidCondition:c}),e(Rm,{columns:Ta,query:y})]})}),e("div",{css:F`
|
|
5733
5733
|
flex: 1 1 auto;
|
|
5734
5734
|
overflow: auto;
|
|
5735
|
-
`,onScroll:A=>T(A.target),ref:a,children:o("table",{css:$n,style:{...xe,width:q.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:q.getHeaderGroups().map(A=>e("tr",{children:A.headers.map(z=>e("th",{style:{width:`calc(var(--header-${z.id}-size) * 1px)`},colSpan:z.colSpan,children:z.isPlaceholder?null:o(J,{children:[o("div",{"data-sortable":z.column.getCanSort(),className:z.column.getCanSort()?"cursor-pointer":"",onClick:z.column.getToggleSortingHandler(),style:{left:z.getStart(),width:z.getSize()},children:[e(
|
|
5735
|
+
`,onScroll:A=>T(A.target),ref:a,children:o("table",{css:$n,style:{...xe,width:q.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:q.getHeaderGroups().map(A=>e("tr",{children:A.headers.map(z=>e("th",{style:{width:`calc(var(--header-${z.id}-size) * 1px)`},colSpan:z.colSpan,children:z.isPlaceholder?null:o(J,{children:[o("div",{"data-sortable":z.column.getCanSort(),className:z.column.getCanSort()?"cursor-pointer":"",onClick:z.column.getToggleSortingHandler(),style:{left:z.getStart(),width:z.getSize()},children:[e(dn,{maxWidth:"100%",children:W(z.column.columnDef.header,z.getContext())}),z.column.getIsSorted()?e(_,{className:"sort-icon",svg:z.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]}),e("div",{onMouseDown:z.getResizeHandler(),onTouchStart:z.getResizeHandler(),className:`resizer ${z.column.getIsResizing()?"isResizing":""}`})]})},z.id))},A.id))}),el?e(Am,{projectName:y.name}):Q.isResizingColumn?e(jF,{table:q}):e(Zm,{table:q})]})}),be.length?e(Bm,{selectedSpans:Qn,onClearSelection:la}):null]})}const qF=({tracesQueryReference:n})=>{const a=x.usePreloadedQuery(Ld,n);return e(BF,{project:a.project})},RT=()=>{const{tracesQueryReference:n}=Ct();return n?e(Xi,{children:o(nu,{children:[e(Ui,{children:e(m.Suspense,{fallback:e(ge,{}),children:e(qF,{tracesQueryReference:n})})}),e(m.Suspense,{children:e(Ce,{})})]})}):null},Ym=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],type:"Project",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"projectLoaderQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"projectLoaderQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,t],storageKey:null}]},params:{cacheID:"146b6f58a3f2f95565821ff5d976155d",id:null,metadata:{},name:"projectLoaderQuery",operationKind:"query",text:`query projectLoaderQuery(
|
|
5736
5736
|
$id: ID!
|
|
5737
5737
|
) {
|
|
5738
5738
|
project: node(id: $id) {
|
|
@@ -5874,7 +5874,7 @@ fragment ProjectsPageProjectsFragment_1bvy9D on Query {
|
|
|
5874
5874
|
}
|
|
5875
5875
|
}
|
|
5876
5876
|
}
|
|
5877
|
-
`}}}();tg.hash="c85f2b2ff3b9697931cca71426ea0b59";const WF=()=>{const{projectViewMode:n,setProjectViewMode:a}=
|
|
5877
|
+
`}}}();tg.hash="c85f2b2ff3b9697931cca71426ea0b59";const WF=()=>{const{projectViewMode:n,setProjectViewMode:a}=cn(l=>({projectViewMode:l.projectViewMode,setProjectViewMode:l.setProjectViewMode}));return o(yt,{css:F`
|
|
5878
5878
|
flex-basis: fit-content;
|
|
5879
5879
|
`,selectedKeys:[n],selectionMode:"single",onSelectionChange:l=>{const t=l.values().next().value;typeof t=="string"&&a(t)},size:"S",children:[o(Ql,{delay:100,children:[e(Fn,{id:"grid",leadingVisual:e(_,{svg:e(Zf,{})})}),e(Bl,{offset:10,children:e(v,{padding:"size-100",backgroundColor:"light",borderColor:"dark",borderWidth:"thin",borderRadius:"small",children:e(C,{children:"View projects in a grid"})})})]}),o(Ql,{delay:100,children:[e(Fn,{id:"table",leadingVisual:e(_,{svg:e(Xf,{})})}),e(Bl,{offset:10,children:e(v,{padding:"size-100",backgroundColor:"light",borderColor:"dark",borderWidth:"thin",borderRadius:"small",children:e(C,{children:"View projects in a table"})})})]})]})},JF="https://docs.arize.com/phoenix/tracing/how-to-tracing/setup-tracing";function ZF({variant:n}){const[a,l]=m.useState(null);return o("div",{children:[e(E,{leadingVisual:e(_,{svg:e(So,{})}),size:"S",variant:n,onPress:()=>{l(e(XF,{}))},children:"New Project"}),e(re,{isDismissable:!0,type:"slideOver",onDismiss:()=>l(null),children:a})]})}function XF(){const[n,a]=m.useState("Python");return e(te,{title:"Create a New Project",size:"L",children:o(v,{padding:"size-400",overflow:"auto",children:[e(v,{paddingBottom:"size-200",children:e(Pl,{language:n,onChange:a})}),e(v,{paddingBottom:"size-100",children:o(C,{children:["Projects are created when you log your first trace via OpenTelemetry. See the"," ",e(Sn,{href:JF,children:"documentation"})," ","for a complete guide."]})}),n==="Python"?e(Yo,{}):e(es,{})]})})}const ig=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"Query",kind:"LinkedField",name:"clearProject",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectActionMenuClearMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectActionMenuClearMutation",selections:a},params:{cacheID:"63319b4e42b499db2447817f1dc821fb",id:null,metadata:{},name:"ProjectActionMenuClearMutation",operationKind:"mutation",text:`mutation ProjectActionMenuClearMutation(
|
|
5880
5880
|
$input: ClearProjectInput!
|
|
@@ -5901,9 +5901,9 @@ fragment ProjectsPageProjectsFragment_1bvy9D on Query {
|
|
|
5901
5901
|
.react-aria-DateInput {
|
|
5902
5902
|
width: 100%;
|
|
5903
5903
|
}
|
|
5904
|
-
`,children:[e(G,{children:"End Date"}),e(Vp,{children:K=>e(zp,{segment:K})}),S?e(Se,{children:S.message}):e(C,{slot:"description",children:`The date up to which you want to remove data. The format is ${l}.`})]})})]}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{type:"submit",variant:"danger",isDisabled:!p||r,size:"S",leadingVisual:r?e(_,{svg:e(en,{})}):void 0,onPress:()=>{var u;(u=t.current)==null||u.requestSubmit()},children:r?"Removing...":"Remove Data"})})})]})}function sg({projectId:n,projectName:a,onProjectDelete:l,onProjectClear:t,onProjectRemoveData:i,variant:r="quiet"}){const[s,d]=m.useState(null),c=a!=="default",[p]=x.useMutation(rg),[y]=x.useMutation(ig),u=m.useCallback(()=>{m.startTransition(()=>{p({variables:{projectId:n}}),l()})},[p,n,l]),g=m.useCallback(()=>{m.startTransition(()=>{y({variables:{input:{id:n}},onCompleted:()=>{t()},onError:S=>{alert("Failed to clear project: "+S)}})})},[y,n,t]),f=m.useCallback(()=>{d(o(te,{size:"S",title:"Delete Project",children:[e(v,{padding:"size-200",children:e(C,{color:"danger",children:`Are you sure you want to delete project ${a}? This cannot be undone.`})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",onPress:()=>{u(),d(null)},children:"Delete Project"})})})]}))},[u,a]),k=m.useCallback(()=>{d(o(te,{size:"S",title:"Clear Project",children:[e(v,{padding:"size-200",children:e(C,{color:"danger",children:`Are you sure you want to clear project ${a}? All traces and evaluations for this project will be deleted. This cannot be undone.`})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",onPress:()=>{g(),d(null)},children:"Clear"})})})]}))},[g,a]),h=m.useCallback(()=>{d(e(te,{size:"S",title:"Remove Data",children:e(YF,{projectId:n,onComplete:()=>{i(),d(null)}})}))},[i,n]);return o("div",{onClick:S=>{S.preventDefault(),S.stopPropagation()},children:[o(zn,{buttonVariant:r,buttonSize:"compact",align:"end",onAction:S=>{switch(S){case"copyName":{navigator.clipboard.writeText(a);return}case"deleteProject":return f();case"clearProject":return k();case"removeProjectData":return h()}},disabledKeys:c?[]:["deleteProject"],children:[e(ue,{textValue:"Copy Name",children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(Wt,{})}),e(C,{children:"Copy Name"})]})},"copyName"),e(ue,{textValue:"Clear All Traces",children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(fo,{})}),e(C,{children:"Clear All Data"})]})},"clearProject"),e(ue,{textValue:"Remove Data",children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(kt,{})}),e(C,{children:"Remove Data"})]})},"removeProjectData"),c?e(ue,{children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(
|
|
5904
|
+
`,children:[e(G,{children:"End Date"}),e(Vp,{children:K=>e(zp,{segment:K})}),S?e(Se,{children:S.message}):e(C,{slot:"description",children:`The date up to which you want to remove data. The format is ${l}.`})]})})]}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{type:"submit",variant:"danger",isDisabled:!p||r,size:"S",leadingVisual:r?e(_,{svg:e(en,{})}):void 0,onPress:()=>{var u;(u=t.current)==null||u.requestSubmit()},children:r?"Removing...":"Remove Data"})})})]})}function sg({projectId:n,projectName:a,onProjectDelete:l,onProjectClear:t,onProjectRemoveData:i,variant:r="quiet"}){const[s,d]=m.useState(null),c=a!=="default",[p]=x.useMutation(rg),[y]=x.useMutation(ig),u=m.useCallback(()=>{m.startTransition(()=>{p({variables:{projectId:n}}),l()})},[p,n,l]),g=m.useCallback(()=>{m.startTransition(()=>{y({variables:{input:{id:n}},onCompleted:()=>{t()},onError:S=>{alert("Failed to clear project: "+S)}})})},[y,n,t]),f=m.useCallback(()=>{d(o(te,{size:"S",title:"Delete Project",children:[e(v,{padding:"size-200",children:e(C,{color:"danger",children:`Are you sure you want to delete project ${a}? This cannot be undone.`})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",onPress:()=>{u(),d(null)},children:"Delete Project"})})})]}))},[u,a]),k=m.useCallback(()=>{d(o(te,{size:"S",title:"Clear Project",children:[e(v,{padding:"size-200",children:e(C,{color:"danger",children:`Are you sure you want to clear project ${a}? All traces and evaluations for this project will be deleted. This cannot be undone.`})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",onPress:()=>{g(),d(null)},children:"Clear"})})})]}))},[g,a]),h=m.useCallback(()=>{d(e(te,{size:"S",title:"Remove Data",children:e(YF,{projectId:n,onComplete:()=>{i(),d(null)}})}))},[i,n]);return o("div",{onClick:S=>{S.preventDefault(),S.stopPropagation()},children:[o(zn,{buttonVariant:r,buttonSize:"compact",align:"end",onAction:S=>{switch(S){case"copyName":{navigator.clipboard.writeText(a);return}case"deleteProject":return f();case"clearProject":return k();case"removeProjectData":return h()}},disabledKeys:c?[]:["deleteProject"],children:[e(ue,{textValue:"Copy Name",children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(Wt,{})}),e(C,{children:"Copy Name"})]})},"copyName"),e(ue,{textValue:"Clear All Traces",children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(fo,{})}),e(C,{children:"Clear All Data"})]})},"clearProject"),e(ue,{textValue:"Remove Data",children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(kt,{})}),e(C,{children:"Remove Data"})]})},"removeProjectData"),c?e(ue,{children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(Ge,{})}),e(C,{children:"Delete"})]})},"deleteProject"):null]}),e(re,{type:"modal",isDismissable:!0,onDismiss:()=>d(null),children:s})]})}const e2=200;function n2({onChange:n}){const a=m.useMemo(()=>ii(t=>{m.startTransition(()=>{n(t)})},e2),[n]),l=m.useCallback(t=>{a(t)},[a]);return e(X,{size:"S",css:F`
|
|
5905
5905
|
flex-basis: 100%;
|
|
5906
|
-
`,"aria-label":"Search projects by name",name:"filter",type:"search",onChange:l,children:e(Z,{placeholder:"Search projects by name"})})}const li=10,Yi=()=>{const{projectSortOrder:n}=
|
|
5906
|
+
`,"aria-label":"Search projects by name",name:"filter",type:"search",onChange:l,children:e(Z,{placeholder:"Search projects by name"})})}const li=10,Yi=()=>{const{projectSortOrder:n}=cn(l=>({projectViewMode:l.projectViewMode,projectSortOrder:l.projectSortOrder}));return m.useMemo(()=>({sort:{col:n.column,dir:n.direction}}),[n])};function NT(){const{timeRange:n}=ct(),a=Yi(),[l]=m.useState(()=>a),t=x.useLazyLoadQuery(tg,{first:li,...l});return e(m.Suspense,{fallback:e(ge,{}),children:e(a2,{timeRange:n,query:t})})}function a2({timeRange:n,query:a}){const{projectViewMode:l}=cn(w=>({projectViewMode:w.projectViewMode})),t=Yi(),[i,r]=m.useState(""),[s,d]=qp(),c=m.useMemo(()=>{var w,$;return{start:(w=n==null?void 0:n.start)==null?void 0:w.toISOString(),end:($=n==null?void 0:n.end)==null?void 0:$.toISOString()}},[n]),{data:p,loadNext:y,hasNext:u,isLoadingNext:g,refetch:f}=x.usePaginationFragment(lg,a),k=m.useMemo(()=>({...t,filter:{value:i,col:"name"}}),[t,i]),h=m.useCallback(({vars:w,onComplete:$})=>{m.startTransition(()=>{f({...k,...w},{fetchPolicy:"store-and-network",onComplete:()=>{$==null||$()}})})},[f,k]),S=p==null?void 0:p.projects.edges.map(w=>w.project),K=m.useRef(null),P=m.useCallback(w=>{if(w){const{scrollHeight:$,scrollTop:M,clientHeight:N}=w;$-M-N<300&&!g&&u&&y(li,{UNSTABLE_extraVariables:k})}},[u,g,y,k]),I=m.useCallback(w=>{h({vars:{sort:w}})},[h]),D=m.useCallback(w=>{m.startTransition(()=>{h({onComplete:()=>{s({variant:"success",title:"Project Deleted",message:`Project ${w} has been deleted.`})}})})},[s,h]),T=m.useCallback(w=>{m.startTransition(()=>{h({onComplete:()=>{s({variant:"success",title:"Project Cleared",message:`Project ${w} has been cleared of traces.`})}})})},[s,h]),L=m.useCallback(w=>{m.startTransition(()=>{h({onComplete:()=>{s({variant:"success",title:"Project Data Removed",message:`Old data from project ${w} have been removed.`})}})})},[s,h]),V=m.useCallback(()=>{y(li,{UNSTABLE_extraVariables:k})},[y,k]);return o("div",{css:F`
|
|
5907
5907
|
display: flex;
|
|
5908
5908
|
flex-direction: column;
|
|
5909
5909
|
overflow: auto;
|
|
@@ -5971,13 +5971,13 @@ fragment ProjectsPageProjectsFragment_1bvy9D on Query {
|
|
|
5971
5971
|
-webkit-box-orient: vertical;
|
|
5972
5972
|
-webkit-line-clamp: 1;
|
|
5973
5973
|
overflow: hidden;
|
|
5974
|
-
`,children:n.name}),e(C,{color:"text-700",size:"XS",fontStyle:"italic",children:c})]})]}),e(sg,{projectId:n.id,projectName:n.name,onProjectDelete:a,onProjectClear:l,onProjectRemoveData:t})]}),e(cg,{projectId:n.id,timeRange:i})]})}const i2=ng;function r2(){return o(b,{direction:"row",justifyContent:"space-between",minHeight:"size-600",children:[o(b,{direction:"column",flex:"none",gap:"size-100",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Total Traces"}),e(Rt,{width:60,height:20,animation:"wave"})]}),o(b,{direction:"column",flex:"none",gap:"size-100",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Total Tokens"}),e(Rt,{width:60,height:20,animation:"wave"})]}),o(b,{direction:"column",flex:"none",gap:"size-100",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Latency P50"}),e(Rt,{width:60,height:20,animation:"wave"})]})]})}const cg=m.memo(function({projectId:a,timeRange:l,flexProps:t}){const i=x.useRelayEnvironment(),r=m.useRef(null),[s,d]=m.useState(null),c=m.useCallback(()=>(d(null),x.fetchQuery(i,i2,{id:a,timeRange:l}).subscribe({next:u=>{d(u)},error:()=>{d(null)}})),[a,l,i]);return m.useEffect(()=>(r.current=c(),()=>{var p;(p=r.current)==null||p.unsubscribe(),r.current=null}),[c]),s==null?e(r2,{}):e(o2,{project:s,flexProps:t})});function o2({project:n,flexProps:a}){const{project:{traceCount:l,tokenCountTotal:t,latencyMsP50:i}}=n;return o(b,{direction:"row",justifyContent:"space-between",minHeight:"size-600",...a,children:[o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Total Traces"}),e(C,{size:"L",children:_a(l)})]}),o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Total Tokens"}),e(C,{size:"L",children:_a(t)})]}),o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Latency P50"}),i!=null?e($e,{latencyMs:i,size:"L"}):e(C,{size:"L",children:"--"})]})]})}const s2=["name","endTime"];function d2({projects:n,onDelete:a,onClear:l,onRemove:t,timeRangeVariable:i,hasNext:r,loadNext:s,isLoadingNext:d,onSort:c}){const p=ce(),y=m.useMemo(()=>[{header:"name",accessorKey:"name",maxSize:135,cell:({row:P})=>o(b,{direction:"row",gap:"size-200",alignItems:"center",children:[e(dg,{gradientStartColor:P.original.gradientStartColor,gradientEndColor:P.original.gradientEndColor}),e(we,{to:`/projects/${P.original.id}`,children:e(
|
|
5974
|
+
`,children:n.name}),e(C,{color:"text-700",size:"XS",fontStyle:"italic",children:c})]})]}),e(sg,{projectId:n.id,projectName:n.name,onProjectDelete:a,onProjectClear:l,onProjectRemoveData:t})]}),e(cg,{projectId:n.id,timeRange:i})]})}const i2=ng;function r2(){return o(b,{direction:"row",justifyContent:"space-between",minHeight:"size-600",children:[o(b,{direction:"column",flex:"none",gap:"size-100",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Total Traces"}),e(Rt,{width:60,height:20,animation:"wave"})]}),o(b,{direction:"column",flex:"none",gap:"size-100",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Total Tokens"}),e(Rt,{width:60,height:20,animation:"wave"})]}),o(b,{direction:"column",flex:"none",gap:"size-100",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Latency P50"}),e(Rt,{width:60,height:20,animation:"wave"})]})]})}const cg=m.memo(function({projectId:a,timeRange:l,flexProps:t}){const i=x.useRelayEnvironment(),r=m.useRef(null),[s,d]=m.useState(null),c=m.useCallback(()=>(d(null),x.fetchQuery(i,i2,{id:a,timeRange:l}).subscribe({next:u=>{d(u)},error:()=>{d(null)}})),[a,l,i]);return m.useEffect(()=>(r.current=c(),()=>{var p;(p=r.current)==null||p.unsubscribe(),r.current=null}),[c]),s==null?e(r2,{}):e(o2,{project:s,flexProps:t})});function o2({project:n,flexProps:a}){const{project:{traceCount:l,tokenCountTotal:t,latencyMsP50:i}}=n;return o(b,{direction:"row",justifyContent:"space-between",minHeight:"size-600",...a,children:[o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Total Traces"}),e(C,{size:"L",children:_a(l)})]}),o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Total Tokens"}),e(C,{size:"L",children:_a(t)})]}),o(b,{direction:"column",flex:"none",children:[e(C,{elementType:"h3",size:"S",color:"text-700",children:"Latency P50"}),i!=null?e($e,{latencyMs:i,size:"L"}):e(C,{size:"L",children:"--"})]})]})}const s2=["name","endTime"];function d2({projects:n,onDelete:a,onClear:l,onRemove:t,timeRangeVariable:i,hasNext:r,loadNext:s,isLoadingNext:d,onSort:c}){const p=ce(),y=m.useMemo(()=>[{header:"name",accessorKey:"name",maxSize:135,cell:({row:P})=>o(b,{direction:"row",gap:"size-200",alignItems:"center",children:[e(dg,{gradientStartColor:P.original.gradientStartColor,gradientEndColor:P.original.gradientEndColor}),e(we,{to:`/projects/${P.original.id}`,children:e(dn,{maxWidth:"300px",children:P.original.name})})]})},{header:"last updated at",accessorKey:"endTime",maxSize:30,cell:_e},{header:"metrics",id:"metrics",enableSorting:!1,cell:({row:P})=>e("div",{css:F`
|
|
5975
5975
|
max-width: 100%;
|
|
5976
|
-
`,children:e(cg,{flexProps:{justifyContent:"start",gap:"size-800",wrap:"wrap",rowGap:"size-100"},projectId:P.original.id,timeRange:i})})},{header:"",id:"actions",enableSorting:!1,size:10,maxSize:10,minSize:10,cell:({row:P})=>e(sg,{variant:"default",projectId:P.original.id,projectName:P.original.name,onProjectClear:()=>l(P.original.name),onProjectRemoveData:()=>t(P.original.name),onProjectDelete:()=>a(P.original.name)})}],[i,l,a,t]),u=Yi(),{setProjectSortOrder:g}=
|
|
5976
|
+
`,children:e(cg,{flexProps:{justifyContent:"start",gap:"size-800",wrap:"wrap",rowGap:"size-100"},projectId:P.original.id,timeRange:i})})},{header:"",id:"actions",enableSorting:!1,size:10,maxSize:10,minSize:10,cell:({row:P})=>e(sg,{variant:"default",projectId:P.original.id,projectName:P.original.name,onProjectClear:()=>l(P.original.name),onProjectRemoveData:()=>t(P.original.name),onProjectDelete:()=>a(P.original.name)})}],[i,l,a,t]),u=Yi(),{setProjectSortOrder:g}=cn(P=>({setProjectSortOrder:P.setProjectSortOrder})),f=m.useMemo(()=>[{id:u.sort.col,desc:u.sort.dir==="desc"}],[u.sort.col,u.sort.dir]),k=m.useCallback(P=>{if(typeof P=="function"){const I=P(f),[D]=I;if(D==null)return;const T=D.id;if(!s2.includes(T))return;c({col:T,dir:D.desc?"desc":"asc"}),g({column:T,direction:D.desc?"desc":"asc"})}},[g,f,c]),h=Ke({data:n,columns:y,getCoreRowModel:Te(),state:{sorting:f},enableSortingRemoval:!1,onSortingChange:k}),K=h.getRowModel().rows.length===0;return e(v,{flex:"none",height:"100%",width:"100%",children:o("div",{css:F`
|
|
5977
5977
|
flex: 1 1 auto;
|
|
5978
5978
|
height: 100%;
|
|
5979
5979
|
width: 100%;
|
|
5980
|
-
`,children:[o("table",{css:
|
|
5980
|
+
`,children:[o("table",{css:He,"data-testid":"projects-table",children:[e("thead",{children:h.getHeaderGroups().map(P=>e("tr",{children:P.headers.map(I=>e("th",{colSpan:I.colSpan,style:{width:I.getSize()},children:I.isPlaceholder?null:o("div",{className:I.column.getCanSort()?"cursor-pointer":"",onClick:I.column.getToggleSortingHandler(),style:{left:I.getStart(),width:I.getSize(),textWrap:"nowrap"},children:[W(I.column.columnDef.header,I.getContext()),I.column.getIsSorted()?e(_,{className:"sort-icon",svg:I.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]})},I.id))},P.id))}),K?e(tn,{}):e("tbody",{children:h.getRowModel().rows.map(P=>e("tr",{onClick:()=>{p(`/projects/${P.original.id}`)},children:P.getVisibleCells().map(I=>e("td",{style:{width:I.column.getSize(),maxWidth:I.column.getSize()},children:W(I.column.columnDef.cell,I.getContext())},I.id))},P.id))})]}),r?e(v,{paddingY:"size-200",children:e(b,{direction:"row",justifyContent:"center",alignItems:"center",width:"100%",children:e(as,{onLoadMore:s,isLoadingNext:d})})}):null]})})}const ug=function(){var n=[{kind:"Literal",name:"first",value:100},{kind:"Literal",name:"sort",value:{col:"createdAt",dir:"desc"}}];return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"DatasetsPageQuery",selections:[{args:null,kind:"FragmentSpread",name:"DatasetsTable_datasets"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"DatasetsPageQuery",selections:[{alias:null,args:n,concreteType:"DatasetConnection",kind:"LinkedField",name:"datasets",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Dataset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"exampleCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"experimentCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",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:'datasets(first:100,sort:{"col":"createdAt","dir":"desc"})'},{alias:null,args:n,filters:["sort"],handle:"connection",key:"DatasetsTable_datasets",kind:"LinkedHandle",name:"datasets"}]},params:{cacheID:"695b221e981c4795492d79faa7d007e4",id:null,metadata:{},name:"DatasetsPageQuery",operationKind:"query",text:`query DatasetsPageQuery {
|
|
5981
5981
|
...DatasetsTable_datasets
|
|
5982
5982
|
}
|
|
5983
5983
|
|
|
@@ -6044,10 +6044,10 @@ fragment DatasetsTable_datasets_dWkdd on Query {
|
|
|
6044
6044
|
__typename
|
|
6045
6045
|
}
|
|
6046
6046
|
}
|
|
6047
|
-
`}}}();pg.hash="bd97316dd472eec18504f66e16088abc";function m2({datasetId:n,datasetName:a,onDatasetDelete:l,onDatasetDeleteError:t}){const[i,r]=x.useMutation(pg),s=m.useCallback(()=>{m.startTransition(()=>{i({variables:{datasetId:n},onCompleted:()=>{l()},onError:d=>{t(d)}})})},[i,n,l,t]);return o(te,{size:"S",title:"Delete Dataset",children:[e(v,{padding:"size-200",children:e(C,{color:"danger",children:`Are you sure you want to delete dataset ${a}? This will also delete all associated experiments and traces, and it cannot be undone.`})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",onPress:()=>{s()},isDisabled:r,leadingVisual:e(_,{svg:r?e(en,{}):e(
|
|
6047
|
+
`}}}();pg.hash="bd97316dd472eec18504f66e16088abc";function m2({datasetId:n,datasetName:a,onDatasetDelete:l,onDatasetDeleteError:t}){const[i,r]=x.useMutation(pg),s=m.useCallback(()=>{m.startTransition(()=>{i({variables:{datasetId:n},onCompleted:()=>{l()},onError:d=>{t(d)}})})},[i,n,l,t]);return o(te,{size:"S",title:"Delete Dataset",children:[e(v,{padding:"size-200",children:e(C,{color:"danger",children:`Are you sure you want to delete dataset ${a}? This will also delete all associated experiments and traces, and it cannot be undone.`})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",onPress:()=>{s()},isDisabled:r,leadingVisual:e(_,{svg:r?e(en,{}):e(Ge,{})}),children:"Delete Dataset"})})})]})}function g2({datasetName:n,datasetId:a,datasetDescription:l,datasetMetadata:t,onDatasetEdited:i,onDatasetEditError:r}){return e(te,{title:"Edit Dataset",size:"M",children:e(nh,{datasetName:n,datasetId:a,datasetDescription:l,datasetMetadata:t,onDatasetEdited:i,onDatasetEditError:r})})}function p2(n){const{datasetId:a,datasetName:l,datasetDescription:t,datasetMetadata:i,onDatasetDelete:r,onDatasetDeleteError:s,onDatasetEdit:d,onDatasetEditError:c}=n,[p,y]=m.useState(null),u=m.useCallback(()=>{y(e(m2,{datasetId:a,datasetName:l,onDatasetDelete:()=>{r(),y(null)},onDatasetDeleteError:s}))},[a,l,r,s]),g=m.useCallback(()=>{y(e(g2,{datasetId:a,datasetName:l,datasetDescription:t,datasetMetadata:i,onDatasetEdited:()=>{d(),y(null)},onDatasetEditError:c}))},[t,a,i,l,d,c]);return o("div",{onClick:f=>{f.preventDefault(),f.stopPropagation()},children:[o(zn,{align:"end",buttonSize:"compact",onAction:f=>{switch(f){case"deleteDataset":u();break;case"editDataset":g();break}},children:[e(ue,{children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(Ge,{})}),e(C,{children:"Delete"})]})},"deleteDataset"),e(ue,{children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(bi,{})}),e(C,{children:"Edit"})]})},"editDataset")]}),e(re,{type:"modal",isDismissable:!0,onDismiss:()=>y(null),children:p})]})}function y2(){return e(v,{width:"100%",paddingY:"size-400",children:e(b,{direction:"column",width:"100%",alignItems:"center",justifyContent:"center",children:e(v,{width:"780px",children:o(b,{direction:"column",gap:"size-400",alignItems:"center",children:[e(C,{size:"XL",children:"Create datasets for testing prompts, experimentation, and fine-tuning."}),e(ah,{src:"https://storage.googleapis.com/arize-phoenix-assets/assets/videos/datasets.mp4",autoPlay:!0,muted:!0,loop:!0}),o(b,{direction:"row",gap:"size-200",children:[e(hr,{href:"https://docs.arize.com/phoenix/datasets-and-experiments/overview-datasets",target:"_blank",leadingVisual:e(_,{svg:e(lh,{})}),children:"Documentation"}),e(hr,{href:"https://colab.research.google.com/github/arize-ai/phoenix/blob/main/tutorials/experiments/datasets_and_experiments_quickstart.ipynb",target:"_blank",leadingVisual:e(_,{svg:e(th,{})}),children:"Quckstart"})]})]})})})})}const Xr=100;function f2(n){const a=n.id;if(a!=="createdAt"&&a!=="name")throw new Error("Invalid sort column");return{col:a,dir:n.desc?"desc":"asc"}}function h2(n){const[a,l]=m.useState([]),t=m.useRef(null),i=ce(),r=me(),s=ke(),{data:d,loadNext:c,hasNext:p,isLoadingNext:y,refetch:u}=x.usePaginationFragment(gg,n.query),g=m.useMemo(()=>d.datasets.edges.map(K=>K.node),[d]),f=m.useCallback(K=>{if(K){const{scrollHeight:P,scrollTop:I,clientHeight:D}=K;P-I-D<300&&!y&&p&&c(Xr)}},[p,y,c]),k=Ke({columns:[{header:"name",accessorKey:"name",cell:({row:K})=>{const I=K.original.experimentCount>0?`${K.original.id}/experiments`:`${K.original.id}/examples`;return e(we,{to:I,children:K.original.name})}},{header:"description",accessorKey:"description",enableSorting:!1},{header:"created at",accessorKey:"createdAt",cell:_e},{header:"example count",accessorKey:"exampleCount",enableSorting:!1,meta:{textAlign:"right"}},{header:"experiment count",accessorKey:"experimentCount",enableSorting:!1,meta:{textAlign:"right"}},{header:"metadata",accessorKey:"metadata",enableSorting:!1,cell:$a},{header:"",id:"actions",enableSorting:!1,size:10,cell:({row:K})=>e(p2,{datasetId:K.original.id,datasetName:K.original.name,datasetDescription:K.original.description,datasetMetadata:K.original.metadata,onDatasetEdit:()=>{r({title:"Dataset updated",message:`${K.original.name} has been successfully updated.`}),u({},{fetchPolicy:"store-and-network"})},onDatasetEditError:P=>{const I=Ie(P);s({title:"Dataset update failed",message:(I==null?void 0:I[0])??P.message})},onDatasetDelete:()=>{r({title:"Dataset deleted",message:`${K.original.name} has been successfully deleted.`}),u({},{fetchPolicy:"store-and-network"})},onDatasetDeleteError:P=>{const I=Ie(P);s({title:"Dataset deletion failed",message:(I==null?void 0:I[0])??P.message})}})}],data:g,state:{sorting:a},getCoreRowModel:Te(),getSortedRowModel:ln(),onSortingChange:l,manualSorting:!0});m.useEffect(()=>{const K=a[0];m.startTransition(()=>{u({sort:K?f2(K):{col:"createdAt",dir:"desc"},after:null,first:Xr},{fetchPolicy:"store-and-network"})})},[a,u]);const h=k.getRowModel().rows,S=h.length===0;return e("div",{css:F`
|
|
6048
6048
|
flex: 1 1 auto;
|
|
6049
6049
|
overflow: auto;
|
|
6050
|
-
`,onScroll:K=>f(K.target),ref:t,children:o("table",{css:$n,children:[e("thead",{children:k.getHeaderGroups().map(K=>e("tr",{children:K.headers.map(P=>{var I;return e("th",{colSpan:P.colSpan,children:P.isPlaceholder?null:o("div",{className:P.column.getCanSort()?"cursor-pointer":"",onClick:P.column.getToggleSortingHandler(),style:{textAlign:(I=P.column.columnDef.meta)==null?void 0:I.textAlign},children:[W(P.column.columnDef.header,P.getContext()),P.column.getIsSorted()?e(_,{className:"sort-icon",svg:P.column.getIsSorted()==="asc"?e(
|
|
6050
|
+
`,onScroll:K=>f(K.target),ref:t,children:o("table",{css:$n,children:[e("thead",{children:k.getHeaderGroups().map(K=>e("tr",{children:K.headers.map(P=>{var I;return e("th",{colSpan:P.colSpan,children:P.isPlaceholder?null:o("div",{className:P.column.getCanSort()?"cursor-pointer":"",onClick:P.column.getToggleSortingHandler(),style:{textAlign:(I=P.column.columnDef.meta)==null?void 0:I.textAlign},children:[W(P.column.columnDef.header,P.getContext()),P.column.getIsSorted()?e(_,{className:"sort-icon",svg:P.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]})},P.id)})},K.id))}),S?e(ih,{children:e(y2,{})}):e("tbody",{children:h.map(K=>e("tr",{onClick:()=>{const I=K.original.experimentCount>0?`${K.original.id}/experiments`:`${K.original.id}/examples`;i(I)},children:K.getVisibleCells().map(P=>{var I;return e("td",{align:(I=P.column.columnDef.meta)==null?void 0:I.textAlign,children:W(P.column.columnDef.cell,P.getContext())},P.id)})},K.id))})]})})}function $T(){return e(m.Suspense,{fallback:e(ge,{}),children:e(k2,{})})}function k2(){const[n,a]=m.useState(0),l=x.useLazyLoadQuery(ug,{},{fetchKey:n,fetchPolicy:"store-and-network"}),t=m.useCallback(()=>{a(i=>i+1)},[a]);return o(b,{direction:"column",height:"100%",children:[e(v,{padding:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",flex:"none",children:o(b,{direction:"row",justifyContent:"space-between",children:[e(ae,{level:1,children:"Datasets"}),e(b2,{onDatasetCreated:t})]})}),e(h2,{query:l})]})}function b2({onDatasetCreated:n}){const a=ce(),l=me(),t=ke(),[i,r]=m.useState(null),s=()=>{r(e(te,{size:"S",title:"New Dataset",children:e(ns,{onDatasetCreated:c=>{l({title:"Dataset created",message:`${c.name} has been successfully created.`,action:{text:"Go to Dataset",onClick:()=>{a(`/datasets/${c.id}`)}}}),r(null),n()},onDatasetCreateError:c=>{const p=Ie(c);t({title:"Dataset creation failed",message:(p==null?void 0:p[0])??c.message})}})}))},d=()=>{r(e(te,{size:"M",title:"New Dataset from CSV",children:e(u2,{onDatasetCreated:c=>{l({title:"Dataset created",message:`${c.name} has been successfully created.`,action:{text:"Go to Dataset",onClick:()=>{a(`/datasets/${c.id}`)}}}),r(null),n()},onDatasetCreateError:c=>{const p=Ie(c);t({title:"Dataset creation failed",message:(p==null?void 0:p[0])??c.message})}})}))};return o(J,{children:[o(zn,{buttonText:"Create Dataset",align:"end",icon:e(_,{svg:e(lt,{})}),onAction:c=>{switch(c){case"newDataset":s();break;case"datasetFromCSV":d();break}},children:[e(ue,{children:"New Dataset"},"newDataset"),e(ue,{children:"Dataset from CSV"},"datasetFromCSV")]}),e(re,{type:"modal",isDismissable:!0,onDismiss:()=>r(null),children:i})]})}const yg=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"datasetId"}],a=[{kind:"Variable",name:"id",variableName:"datasetId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:1},{kind:"Literal",name:"sort",value:{col:"createdAt",dir:"desc"}}],concreteType:"DatasetVersionConnection",kind:"LinkedField",name:"versions",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"DatasetVersion",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:'versions(first:1,sort:{"col":"createdAt","dir":"desc"})'}],type:"Dataset",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"datasetStore_latestVersionQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"datasetStore_latestVersionQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,t],storageKey:null}]},params:{cacheID:"8d1b89f8e5b4cd2774b9862c9aff1d3e",id:null,metadata:{},name:"datasetStore_latestVersionQuery",operationKind:"query",text:`query datasetStore_latestVersionQuery(
|
|
6051
6051
|
$datasetId: ID!
|
|
6052
6052
|
) {
|
|
6053
6053
|
dataset: node(id: $datasetId) {
|
|
@@ -6073,7 +6073,7 @@ fragment DatasetsTable_datasets_dWkdd on Query {
|
|
|
6073
6073
|
__typename
|
|
6074
6074
|
}
|
|
6075
6075
|
}
|
|
6076
|
-
`}}}();hg.hash="8d99470f590cd5d28701fa6e3c0330e6";const Bt={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function F2(n){const{datasetId:a,onCompleted:l}=n,[t,i]=m.useState(null),[r,s]=x.useMutation(hg),{control:d,setError:c,handleSubmit:p,formState:{isValid:y}}=Ve({defaultValues:{input:"{}",output:"{}",metadata:"{}"}}),u=m.useCallback(g=>{if(i(null),!Bn(g==null?void 0:g.input))return c("input",{message:"Input must be a valid JSON object"});if(!Bn(g==null?void 0:g.output))return c("output",{message:"Output must be a valid JSON object"});if(!Bn(g==null?void 0:g.metadata))return c("metadata",{message:"Metadata must be a valid JSON object"});r({variables:{input:{datasetId:a,examples:[{input:JSON.parse(g.input),output:JSON.parse(g.output),metadata:JSON.parse(g.metadata)}],datasetVersionDescription:g.description}},onCompleted:()=>{l()},onError:f=>{const k=
|
|
6076
|
+
`}}}();hg.hash="8d99470f590cd5d28701fa6e3c0330e6";const Bt={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function F2(n){const{datasetId:a,onCompleted:l}=n,[t,i]=m.useState(null),[r,s]=x.useMutation(hg),{control:d,setError:c,handleSubmit:p,formState:{isValid:y}}=Ve({defaultValues:{input:"{}",output:"{}",metadata:"{}"}}),u=m.useCallback(g=>{if(i(null),!Bn(g==null?void 0:g.input))return c("input",{message:"Input must be a valid JSON object"});if(!Bn(g==null?void 0:g.output))return c("output",{message:"Output must be a valid JSON object"});if(!Bn(g==null?void 0:g.metadata))return c("metadata",{message:"Metadata must be a valid JSON object"});r({variables:{input:{datasetId:a,examples:[{input:JSON.parse(g.input),output:JSON.parse(g.output),metadata:JSON.parse(g.metadata)}],datasetVersionDescription:g.description}},onCompleted:()=>{l()},onError:f=>{const k=Ie(f);i((k==null?void 0:k[0])??f.message)}})},[r,a,c,l]);return o(te,{size:"L",title:"Add Example",children:[e("div",{css:F`
|
|
6077
6077
|
overflow-y: auto;
|
|
6078
6078
|
padding: var(--ac-global-dimension-size-400);
|
|
6079
6079
|
`,children:e(b,{direction:"row",justifyContent:"center",children:e(v,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:o(b,{direction:"column",gap:"size-200",children:[t?e(Fe,{variant:"danger",children:t}):null,e(H,{control:d,name:"input",render:({field:{onChange:g,onBlur:f,value:k},fieldState:{invalid:h,error:S}})=>o(B,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",...Bt,children:[h?e(Fe,{variant:"danger",banner:!0,children:S==null?void 0:S.message}):null,e(on,{value:k,onChange:g,onBlur:f})]})}),e(H,{control:d,name:"output",render:({field:{onChange:g,onBlur:f,value:k},fieldState:{invalid:h,error:S}})=>o(B,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",...Bt,backgroundColor:"green-100",borderColor:"green-700",children:[h?e(Fe,{variant:"danger",banner:!0,children:S==null?void 0:S.message}):null,e(on,{value:k,onChange:g,onBlur:f})]})}),e(H,{control:d,name:"metadata",render:({field:{onChange:g,onBlur:f,value:k},fieldState:{invalid:h,error:S}})=>o(B,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",...Bt,children:[h?e(Fe,{variant:"danger",banner:!0,children:S==null?void 0:S.message}):null,e(on,{value:k,onChange:g,onBlur:f})]})}),e(H,{control:d,name:"description",render:({field:{onChange:g,onBlur:f,value:k},fieldState:{invalid:h,error:S}})=>o(X,{value:k,onChange:g,onBlur:f,isInvalid:h,children:[e(G,{children:"Version Description"}),e(fa,{}),S?e(Se,{children:S.message}):e(C,{slot:"description",children:"A description of the changes made. Will be displayed in the version history."})]})})]})})})}),e(v,{padding:"size-200",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",gap:"size-100",children:e(E,{variant:"primary",size:"S",isDisabled:!y||s,leadingVisual:s?e(_,{svg:e(en,{})}):null,onPress:()=>p(u)(),children:s?"Adding Example...":"Add Example"})})})]})}function K2(n){const{datasetId:a,onAddExampleCompleted:l}=n,[t,i]=m.useState(null),r=m.useCallback(()=>{i(e(F2,{datasetId:a,onCompleted:()=>{l(),i(null)}}))},[a,l]);return o(J,{children:[e(E,{leadingVisual:e(_,{svg:e(Nn,{})}),size:"S",onPress:r,"aria-label":"Add Dataset Example",children:"Add Example"}),e(re,{isDismissable:!0,onDismiss:()=>{i(null)},children:t})]})}function T2(){const n=ya(i=>i.datasetId),a=ya(i=>i.latestVersion);let l=`${Ht}/v1/datasets/${n}/examples`;a&&(l+=`?version-id=${a.id}`);const t=m.useMemo(()=>`import phoenix as px
|
|
@@ -6155,9 +6155,9 @@ fragment DatasetHistoryTable_versions_2HEEH6 on Dataset {
|
|
|
6155
6155
|
`}}}();bg.hash="37e453bc58759a1e89bc5862c460de6b";const Sg=function(){var n=["versions"],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:100,kind:"LocalArgument",name:"first"}],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:bg,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"DatasetHistoryTable_versions",selections:[{alias:"versions",args:null,concreteType:"DatasetVersionConnection",kind:"LinkedField",name:"__DatasetHistoryTable_versions_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"DatasetVersion",kind:"LinkedField",name:"node",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",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},a],type:"Dataset",abstractKey:null}}();Sg.hash="37e453bc58759a1e89bc5862c460de6b";const P2=100;function x2(n){const a=m.useRef(null),{data:l,loadNext:t,hasNext:i,isLoadingNext:r}=x.usePaginationFragment(Sg,n.dataset),s=m.useMemo(()=>l.versions.edges.map(u=>u.node),[l]),d=m.useCallback(u=>{if(u){const{scrollHeight:g,scrollTop:f,clientHeight:k}=u;g-f-k<300&&!r&&i&&t(P2)}},[i,r,t]),c=Ke({columns:[{header:"version ID",accessorKey:"id"},{header:"description",accessorKey:"description"},{header:"created at",accessorKey:"createdAt",cell:_e}],data:s,getCoreRowModel:Te(),getSortedRowModel:ln()}),p=c.getRowModel().rows,y=p.length===0;return e("div",{css:F`
|
|
6156
6156
|
flex: 1 1 auto;
|
|
6157
6157
|
overflow: auto;
|
|
6158
|
-
`,onScroll:u=>d(u.target),ref:a,children:o("table",{css:
|
|
6158
|
+
`,onScroll:u=>d(u.target),ref:a,children:o("table",{css:He,children:[e("thead",{children:c.getHeaderGroups().map(u=>e("tr",{children:u.headers.map(g=>e("th",{colSpan:g.colSpan,children:g.isPlaceholder?null:o("div",{className:g.column.getCanSort()?"cursor-pointer":"",onClick:g.column.getToggleSortingHandler(),style:{left:g.getStart(),width:g.getSize()},children:[W(g.column.columnDef.header,g.getContext()),g.column.getIsSorted()?e(_,{className:"sort-icon",svg:g.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]})},g.id))},u.id))}),y?e(tn,{}):e("tbody",{children:p.map(u=>e("tr",{children:u.getVisibleCells().map(g=>e("td",{children:W(g.column.columnDef.cell,g.getContext())},g.id))},u.id))})]})})}function I2(n){const{datasetId:a}=n,l=x.useLazyLoadQuery(kg,{datasetId:a});return e(te,{size:"L",title:"Dataset History",children:e("div",{css:F`
|
|
6159
6159
|
height: 500px;
|
|
6160
|
-
`,children:e(x2,{dataset:l.dataset})})})}function D2(n){const{datasetId:a}=n,[l,t]=m.useState(null);return o(J,{children:[o(
|
|
6160
|
+
`,children:e(x2,{dataset:l.dataset})})})}function D2(n){const{datasetId:a}=n,[l,t]=m.useState(null);return o(J,{children:[o(Le,{children:[e(E,{leadingVisual:e(_,{svg:e(rh,{})}),"aria-label":"Version History",onPress:()=>{t(e(I2,{datasetId:a}))}}),e(gn,{children:"Dataset Version History"})]}),e(m.Suspense,{fallback:null,children:e(re,{type:"modal",isDismissable:!0,onDismiss:()=>{t(null)},children:l})})]})}const L2=`pip install arize-phoenix>=${window.Config.platformVersion}`;function _2({isAuthEnabled:n}){let a=`import os
|
|
6161
6161
|
# Set the phoenix collector endpoint. Commonly http://localhost:6006
|
|
6162
6162
|
os.environ["PHOENIX_COLLECTOR_ENDPOINT"] = "<your-phoenix-url>"`;return n&&(a+=`
|
|
6163
6163
|
# Configure access
|
|
@@ -6221,7 +6221,7 @@ await runExperiment({
|
|
|
6221
6221
|
# Initialize a phoenix client
|
|
6222
6222
|
client = px.Client()
|
|
6223
6223
|
# Get the current dataset version. You can omit the version for the latest.
|
|
6224
|
-
dataset = client.get_dataset(name="${n}"${a?`, version_id="${a.id}"`:""})`,[n,a]);return o(v,{overflow:"auto",children:[e(v,{paddingBottom:"size-100",children:e(C,{children:"Install Phoenix"})}),e(
|
|
6224
|
+
dataset = client.get_dataset(name="${n}"${a?`, version_id="${a.id}"`:""})`,[n,a]);return o(v,{overflow:"auto",children:[e(v,{paddingBottom:"size-100",children:e(C,{children:"Install Phoenix"})}),e(Ze,{children:e(Ln,{value:L2})}),e(v,{paddingTop:"size-100",paddingBottom:"size-100",children:e(C,{children:"Point to a running instance of Phoenix"})}),e(Ze,{children:e(Ln,{value:_2({isAuthEnabled:l})})}),e(oh,{children:e(v,{paddingBottom:"size-100",paddingTop:"size-100",children:e(ho,{fallback:o(C,{children:["Your personal API keys can be created and managed on your"," ",e(Sn,{href:"/profile",children:"Profile"})]}),children:o(C,{children:["System API keys can be created and managed in"," ",e(Sn,{href:"/settings/general",children:"Settings"})]})})})}),e(v,{paddingTop:"size-100",paddingBottom:"size-100",children:e(C,{children:"Pull down this dataset"})}),e(Ze,{children:e(Ln,{value:t})}),e(v,{paddingTop:"size-100",paddingBottom:"size-100",children:e(C,{children:"Define your task"})}),e(Ze,{children:e(Ln,{value:A2})}),e(v,{paddingTop:"size-100",paddingBottom:"size-100",children:e(C,{children:"Define evaluators"})}),e(Ze,{children:e(Ln,{value:w2})}),e(v,{paddingTop:"size-100",paddingBottom:"size-100",children:e(C,{children:"Run an experiment"})}),e(Ze,{children:e(Ln,{value:R2})})]})}function V2(){const n=ya(a=>a.datasetName);return o(v,{overflow:"auto",children:[e(v,{paddingBottom:"size-100",children:e(C,{children:"Install Phoenix Client"})}),e(Ze,{children:e(Xt,{value:"npm install @arizeai/phoenix-client"})}),e(v,{paddingTop:"size-100",paddingBottom:"size-100",children:e(C,{children:"Run an experiment"})}),e(Ze,{children:e(Xt,{value:E2(n,"experiment_name")})})]})}function z2(){const[n,a]=m.useState("Python");return e(te,{title:"Run Experiment",size:"XL",children:o(v,{padding:"size-400",overflow:"auto",children:[e(v,{paddingBottom:"size-200",children:e(Pl,{language:n,onChange:a})}),n==="Python"?e(M2,{}):e(V2,{})]})})}function vg(){const[n,a]=m.useState(null),l=m.useCallback(()=>{a(e(z2,{}))},[]);return o(J,{children:[e(E,{size:"S",leadingVisual:e(_,{svg:e(zo,{})}),onPress:l,children:"Run Experiment"}),e(re,{isDismissable:!0,type:"slideOver",onDismiss:()=>{a(null)},children:n})]})}function jT(){const n=Me();je(n);const a=m.useMemo(()=>{const l=n.dataset.latestVersions;return l!=null&&l.edges&&l.edges.length?l.edges[0].version:null},[n]);return e(C2,{datasetId:n.dataset.id,datasetName:n.dataset.name,latestVersion:a,children:e(m.Suspense,{fallback:e(ge,{}),children:e($2,{dataset:n.dataset})})})}const N2=F`
|
|
6225
6225
|
flex: 1 1 auto;
|
|
6226
6226
|
display: flex;
|
|
6227
6227
|
flex-direction: column;
|
|
@@ -6351,12 +6351,12 @@ fragment ExamplesTableFragment_4a6F8Z on Dataset {
|
|
|
6351
6351
|
}
|
|
6352
6352
|
}
|
|
6353
6353
|
}
|
|
6354
|
-
`}}}();Pg.hash="455bf9e5dc4b9cc655095dc829ef7e12";function j2(n){const a=ya(f=>f.refreshLatestVersion),{selectedExamples:l,onExamplesDeleted:t,onClearSelection:i}=n,[r,s]=m.useState(null),d=me(),c=ke(),[p,y]=x.useMutation(Pg),u=l.length!==1,g=m.useCallback(()=>{p({variables:{input:{exampleIds:l.map(f=>f.id)}},onCompleted:()=>{d({title:"Examples Deleted",message:`${l.length} example${u?"s":""} have been deleted.`}),t(),i(),a()},onError:f=>{const k=
|
|
6354
|
+
`}}}();Pg.hash="455bf9e5dc4b9cc655095dc829ef7e12";function j2(n){const a=ya(f=>f.refreshLatestVersion),{selectedExamples:l,onExamplesDeleted:t,onClearSelection:i}=n,[r,s]=m.useState(null),d=me(),c=ke(),[p,y]=x.useMutation(Pg),u=l.length!==1,g=m.useCallback(()=>{p({variables:{input:{exampleIds:l.map(f=>f.id)}},onCompleted:()=>{d({title:"Examples Deleted",message:`${l.length} example${u?"s":""} have been deleted.`}),t(),i(),a()},onError:f=>{const k=Ie(f);c({title:"An error occurred",message:`Failed to delete examples: ${(k==null?void 0:k[0])??f.message}`})}})},[p,l,d,u,t,i,a,c]);return o("div",{css:F`
|
|
6355
6355
|
position: absolute;
|
|
6356
6356
|
bottom: var(--ac-global-dimension-size-400);
|
|
6357
6357
|
left: 50%;
|
|
6358
6358
|
transform: translateX(-50%);
|
|
6359
|
-
`,children:[e(v,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:o(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(C,{children:`${l.length} example${u?"s":""} selected`}),o(b,{direction:"row",gap:"size-100",children:[e(E,{variant:"default",size:"S",onPress:i,children:"Cancel"}),e(E,{variant:"danger",size:"S",leadingVisual:e(_,{svg:y?e(en,{}):e(
|
|
6359
|
+
`,children:[e(v,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:o(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(C,{children:`${l.length} example${u?"s":""} selected`}),o(b,{direction:"row",gap:"size-100",children:[e(E,{variant:"default",size:"S",onPress:i,children:"Cancel"}),e(E,{variant:"danger",size:"S",leadingVisual:e(_,{svg:y?e(en,{}):e(Ge,{})}),isDisabled:y,onPress:g,children:y?"Deleting...":"Delete Example"+(u?"s":"")})]})]})}),e(re,{onDismiss:()=>{s(null)},children:r})]})}const O2=100;function Q2({dataset:n}){const a=ya(D=>D.latestVersion),l=m.useRef(null),[t,i]=m.useState({}),{data:r,loadNext:s,hasNext:d,isLoadingNext:c,refetch:p}=x.usePaginationFragment(Tg,n);m.useEffect(()=>{m.startTransition(()=>{p({datasetVersionId:(a==null?void 0:a.id)||null},{fetchPolicy:"store-and-network"})})},[a,p]);const y=m.useMemo(()=>r.examples.edges.map(D=>{const T=D.example,L=T.revision;return{id:T.id,input:L.input,output:L.output,metadata:L.metadata}}),[r]),g=Ke({columns:[{id:"select",header:({table:D})=>e(Mn,{checked:D.getIsAllRowsSelected(),indeterminate:D.getIsSomeRowsSelected(),onChange:D.getToggleAllRowsSelectedHandler()}),cell:({row:D})=>e(Mn,{checked:D.getIsSelected(),disabled:!D.getCanSelect(),indeterminate:D.getIsSomeSelected(),onChange:D.getToggleSelectedHandler()})},{header:"example id",accessorKey:"id",cell:({getValue:D,row:T})=>{const L=T.original.id;return e(we,{to:`${L}`,children:D()})}},{header:"input",accessorKey:"input",cell:$a},{header:"output",accessorKey:"output",cell:$a},{header:"metadata",accessorKey:"metadata",cell:$a}],data:y,state:{rowSelection:t},onRowSelectionChange:i,getCoreRowModel:Te()}),f=g.getRowModel().rows,k=f.length===0,h=g.getSelectedRowModel().rows,S=h.map(D=>D.original),K=m.useCallback(()=>{i({})},[i]),P=m.useCallback(D=>{if(D){const{scrollHeight:T,scrollTop:L,clientHeight:V}=D;T-L-V<300&&!c&&d&&s(O2)}},[d,c,s]),I=ce();return o("div",{css:F`
|
|
6360
6360
|
flex: 1 1 auto;
|
|
6361
6361
|
overflow: auto;
|
|
6362
6362
|
`,ref:l,onScroll:D=>P(D.target),children:[o("table",{css:$n,children:[e("thead",{children:g.getHeaderGroups().map(D=>e("tr",{children:D.headers.map(T=>e("th",{children:e("div",{children:W(T.column.columnDef.header,T.getContext())})},T.id))},D.id))}),k?e(tn,{}):e("tbody",{children:f.map(D=>e("tr",{onClick:()=>{I(`${D.original.id}`)},children:D.getVisibleCells().map(T=>e("td",{children:W(T.column.columnDef.cell,T.getContext())},T.id))},D.id))})]}),h.length?e(j2,{selectedExamples:S,onClearSelection:K,onExamplesDeleted:()=>{p({},{fetchPolicy:"store-and-network"})}}):null]})}function qT(){const n=Me();return je(n),o(J,{children:[e(Q2,{dataset:n.dataset})," ",e(m.Suspense,{children:e(Ce,{})})]})}const xg=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"annotationName",storageKey:null},r=[{kind:"Literal",name:"first",value:100}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"experimentsLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{args:null,kind:"FragmentSpread",name:"ExperimentsTableFragment"}],type:"Dataset",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"experimentsLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"experimentAnnotationSummaries",plural:!0,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"minScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"maxScore",storageKey:null}],storageKey:null},{alias:null,args:r,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"errorRate",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"runCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"averageRunLatencyMs",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[l],storageKey:null},{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"annotationSummaries",plural:!0,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[t,l],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:"experiments(first:100)"},{alias:null,args:r,filters:null,handle:"connection",key:"ExperimentsTable_experiments",kind:"LinkedHandle",name:"experiments"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"408cf8f25f19c40db245b9f45d2a5ed2",id:null,metadata:{},name:"experimentsLoaderQuery",operationKind:"query",text:`query experimentsLoaderQuery(
|
|
@@ -6468,12 +6468,12 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
|
|
|
6468
6468
|
__typename
|
|
6469
6469
|
}
|
|
6470
6470
|
}
|
|
6471
|
-
`}}}();Lg.hash="4ab310746eb51c6a3fcb799d2c972762";function U2(n){const a=ce(),[l,t]=m.useState(null),[i,r]=x.useMutation(Lg),{datasetId:s,selectedExperiments:d,onClearSelection:c,onExperimentsDeleted:p}=n,y=d.length!==1,u=me(),g=ke(),f=m.useCallback(()=>{i({variables:{input:{experimentIds:d.map(h=>h.id)}},onCompleted:()=>{u({title:"Experiments Deleted",message:`${d.length} experiment${y?"s":""} have been deleted.`}),p(),c()},onError:h=>{const S=
|
|
6471
|
+
`}}}();Lg.hash="4ab310746eb51c6a3fcb799d2c972762";function U2(n){const a=ce(),[l,t]=m.useState(null),[i,r]=x.useMutation(Lg),{datasetId:s,selectedExperiments:d,onClearSelection:c,onExperimentsDeleted:p}=n,y=d.length!==1,u=me(),g=ke(),f=m.useCallback(()=>{i({variables:{input:{experimentIds:d.map(h=>h.id)}},onCompleted:()=>{u({title:"Experiments Deleted",message:`${d.length} experiment${y?"s":""} have been deleted.`}),p(),c()},onError:h=>{const S=Ie(h);g({title:"An error occurred",message:`Failed to delete experiments: ${(S==null?void 0:S[0])??h.message}`})}})},[i,y,g,u,c,p,d]),k=m.useCallback(()=>{t(o(te,{size:"S",title:"Delete Experiments",children:[e(v,{padding:"size-200",children:e(C,{color:"danger",children:"Are you sure you want to delete these experiments? This will also delete all associated annotations and traces, and it cannot be undone."})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(b,{direction:"row",justifyContent:"end",children:e(E,{variant:"danger",onPress:()=>{f(),t(null)},children:"Delete Experiments"})})})]}))},[f]);return o("div",{css:F`
|
|
6472
6472
|
position: absolute;
|
|
6473
6473
|
bottom: var(--ac-global-dimension-size-400);
|
|
6474
6474
|
left: 50%;
|
|
6475
6475
|
transform: translateX(-50%);
|
|
6476
|
-
`,children:[e(v,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:o(b,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:"size-100",children:[e(C,{children:`${d.length} experiment${y?"s":""} selected`}),o(b,{direction:"row",gap:"size-100",children:[e(E,{variant:"default",size:"S",onPress:c,children:"Cancel"}),e(E,{variant:"danger",size:"S",leadingVisual:e(_,{svg:r?e(en,{}):e(
|
|
6476
|
+
`,children:[e(v,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:o(b,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:"size-100",children:[e(C,{children:`${d.length} experiment${y?"s":""} selected`}),o(b,{direction:"row",gap:"size-100",children:[e(E,{variant:"default",size:"S",onPress:c,children:"Cancel"}),e(E,{variant:"danger",size:"S",leadingVisual:e(_,{svg:r?e(en,{}):e(Ge,{})}),isDisabled:r,onPress:k,children:r?"Deleting...":"Delete"}),e(E,{variant:"primary",size:"S",onPress:()=>{a(`/datasets/${s}/compare?${d.map(h=>`experimentId=${h.id}`).join("&")}`)},leadingVisual:e(_,{svg:e(sh,{})}),children:"Compare Experiments"})]})]})}),e(re,{onDismiss:()=>{t(null)},children:l})]})}const H2=100;function G2(){return e("tbody",{className:"is-empty",children:e("tr",{children:o("td",{colSpan:100,css:F`
|
|
6477
6477
|
text-align: center;
|
|
6478
6478
|
padding: var(--ac-global-dimension-size-400) !important;
|
|
6479
6479
|
button {
|
|
@@ -6487,7 +6487,7 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
|
|
|
6487
6487
|
flex: 1 1 auto;
|
|
6488
6488
|
overflow: auto;
|
|
6489
6489
|
width: table.getTotalSize();
|
|
6490
|
-
`,ref:a,onScroll:T=>I(T.target),children:[o("table",{css:$n,children:[e("thead",{children:f.getHeaderGroups().map(T=>e("tr",{children:T.headers.map(L=>{var V,w;return e("th",{align:(w=(V=L.column.columnDef)==null?void 0:V.meta)==null?void 0:w.textAlign,children:e("div",{children:W(L.column.columnDef.header,L.getContext())})},L.id)})},T.id))}),P?e(G2,{}):e("tbody",{children:k.map(T=>e("tr",{onClick:()=>{D(`/datasets/${n.id}/compare?experimentId=${T.original.id}`)},children:T.getVisibleCells().map(L=>e("td",{children:W(L.column.columnDef.cell,L.getContext())},L.id))},T.id))})]}),h.length?e(U2,{datasetId:n.id,selectedExperiments:S,onClearSelection:K,onExperimentsDeleted:()=>{c({},{fetchPolicy:"store-and-network"})}}):null]})}function J2({annotationName:n,value:a,min:l,max:t}){const i=Lo(n),r=m.useMemo(()=>{const s=typeof l=="number"?l:0,d=typeof t=="number"?t:1;if(s===d&&d===a)return 100;const c=d-s||1;return(a-s)/c*100},[a,l,t]);return o(
|
|
6490
|
+
`,ref:a,onScroll:T=>I(T.target),children:[o("table",{css:$n,children:[e("thead",{children:f.getHeaderGroups().map(T=>e("tr",{children:T.headers.map(L=>{var V,w;return e("th",{align:(w=(V=L.column.columnDef)==null?void 0:V.meta)==null?void 0:w.textAlign,children:e("div",{children:W(L.column.columnDef.header,L.getContext())})},L.id)})},T.id))}),P?e(G2,{}):e("tbody",{children:k.map(T=>e("tr",{onClick:()=>{D(`/datasets/${n.id}/compare?experimentId=${T.original.id}`)},children:T.getVisibleCells().map(L=>e("td",{children:W(L.column.columnDef.cell,L.getContext())},L.id))},T.id))})]}),h.length?e(U2,{datasetId:n.id,selectedExperiments:S,onClearSelection:K,onExperimentsDeleted:()=>{c({},{fetchPolicy:"store-and-network"})}}):null]})}function J2({annotationName:n,value:a,min:l,max:t}){const i=Lo(n),r=m.useMemo(()=>{const s=typeof l=="number"?l:0,d=typeof t=="number"?t:1;if(s===d&&d===a)return 100;const c=d-s||1;return(a-s)/c*100},[a,l,t]);return o(Le,{children:[e(Ne,{children:o("div",{css:F`
|
|
6491
6491
|
float: right;
|
|
6492
6492
|
--mod-barloader-fill-color: ${i};
|
|
6493
6493
|
display: flex;
|
|
@@ -6600,7 +6600,7 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
|
|
|
6600
6600
|
border-color: var(--ac-global-color-danger);
|
|
6601
6601
|
}
|
|
6602
6602
|
box-sizing: border-box;
|
|
6603
|
-
`;function Y2(n){const a=n.matchBefore(/\w*/);return!a||a.from==a.to&&!n.explicit?null:{from:a.from,options:[{label:"input",type:"variable",info:"The input of the dataset example"},{label:"reference_output",type:"variable",info:"The reference output of the dataset example"},{label:"metadata",type:"variable",info:"The metadata of the dataset example"},{label:"output",type:"variable",info:"The output of the experiment run"},{label:"error",type:"variable",info:"The error message of the experiment run (if exists)"},{label:"latency_ms",type:"variable",info:"The duration of the experiment run in milliseconds"},{label:"evals",type:"variable",info:"The evaluations of the experiment run"},{label:"search input",type:"text",apply:"'' in input",detail:"macro"},{label:"search reference output",type:"text",apply:"'' in reference_output",detail:"macro"},{label:"search output",type:"text",apply:"'' in output",detail:"macro"},{label:"has error",type:"text",apply:"error is not None",detail:"macro"},{label:"Latency >= 10s",type:"text",apply:"latency_ms >= 10_000",detail:"macro"},{label:"Hallucinations",type:"text",apply:"evals['hallucination'].label == 'hallucinated'",detail:"macro"},{label:"Metadata",type:"text",apply:"metadata['category'] == 'hard_examples'",detail:"macro"}]}}async function eK(n,a){if(!n)return{isValid:!0,errorMessage:null};const l=await Fl.fetchQuery(he,Ag,{condition:n,experimentIds:a}).toPromise();if(!l)throw new Error("Filter condition validation is null");return l.validateExperimentRunFilterCondition}const nK=[Ai.of([{key:"Enter",run:n=>!0}]),xl(),rs({override:[Y2]})];function aK(n){const{onValidCondition:a,placeholder:l=`filter condition (e.g., evals["Hallucination"].label == 'hallucinated')`}=n,[t,i]=m.useState(!1),[r,s]=m.useState(""),{filterCondition:d,setFilterCondition:c,appendFilterCondition:p}=Z2(),y=m.useDeferredValue(d),{theme:u}=Xn(),g=u==="light"?Ca:Fa,[f]=
|
|
6603
|
+
`;function Y2(n){const a=n.matchBefore(/\w*/);return!a||a.from==a.to&&!n.explicit?null:{from:a.from,options:[{label:"input",type:"variable",info:"The input of the dataset example"},{label:"reference_output",type:"variable",info:"The reference output of the dataset example"},{label:"metadata",type:"variable",info:"The metadata of the dataset example"},{label:"output",type:"variable",info:"The output of the experiment run"},{label:"error",type:"variable",info:"The error message of the experiment run (if exists)"},{label:"latency_ms",type:"variable",info:"The duration of the experiment run in milliseconds"},{label:"evals",type:"variable",info:"The evaluations of the experiment run"},{label:"search input",type:"text",apply:"'' in input",detail:"macro"},{label:"search reference output",type:"text",apply:"'' in reference_output",detail:"macro"},{label:"search output",type:"text",apply:"'' in output",detail:"macro"},{label:"has error",type:"text",apply:"error is not None",detail:"macro"},{label:"Latency >= 10s",type:"text",apply:"latency_ms >= 10_000",detail:"macro"},{label:"Hallucinations",type:"text",apply:"evals['hallucination'].label == 'hallucinated'",detail:"macro"},{label:"Metadata",type:"text",apply:"metadata['category'] == 'hard_examples'",detail:"macro"}]}}async function eK(n,a){if(!n)return{isValid:!0,errorMessage:null};const l=await Fl.fetchQuery(he,Ag,{condition:n,experimentIds:a}).toPromise();if(!l)throw new Error("Filter condition validation is null");return l.validateExperimentRunFilterCondition}const nK=[Ai.of([{key:"Enter",run:n=>!0}]),xl(),rs({override:[Y2]})];function aK(n){const{onValidCondition:a,placeholder:l=`filter condition (e.g., evals["Hallucination"].label == 'hallucinated')`}=n,[t,i]=m.useState(!1),[r,s]=m.useState(""),{filterCondition:d,setFilterCondition:c,appendFilterCondition:p}=Z2(),y=m.useDeferredValue(d),{theme:u}=Xn(),g=u==="light"?Ca:Fa,[f]=mn(),k=f.getAll("experimentId");m.useEffect(()=>{eK(y,k).then(K=>{K!=null&&K.isValid?(s(""),m.startTransition(()=>{a(y)})):s((K==null?void 0:K.errorMessage)??"Invalid filter condition")})},[a,y,k]);const h=r!=="";return o("div",{"data-is-focused":t,"data-is-invalid":h,css:Eg,children:[o(b,{direction:"row",children:[e(ci,{children:e(_,{svg:e(_i,{})})}),e(Ka,{css:Rg,indentWithTab:!1,basicSetup:{lineNumbers:!1,foldGutter:!1,bracketMatching:!0,syntaxHighlighting:!0,highlightActiveLine:!1,highlightActiveLineGutter:!1,defaultKeymap:!1},onFocus:()=>i(!0),onBlur:()=>i(!1),value:d,onChange:c,height:"36px",width:"100%",theme:g,placeholder:l,extensions:nK}),e("button",{css:F`
|
|
6604
6604
|
margin-right: var(--ac-global-dimension-static-size-100);
|
|
6605
6605
|
color: var(--ac-global-text-color-700);
|
|
6606
6606
|
visibility: ${d!==""?"visible":"hidden"};
|
|
@@ -6610,7 +6610,7 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
|
|
|
6610
6610
|
padding-left: var(--ac-global-dimension-static-size-100);
|
|
6611
6611
|
padding-right: var(--ac-global-dimension-static-size-100);
|
|
6612
6612
|
height: 100%;
|
|
6613
|
-
`,className:"button--reset",children:e(_,{svg:e(Nn,{})})})}),e(lK,{onAddFilterConditionSnippet:p})]})]}),o(
|
|
6613
|
+
`,className:"button--reset",children:e(_,{svg:e(Nn,{})})})}),e(lK,{onAddFilterConditionSnippet:p})]})]}),o(Le,{isOpen:h&&t,placement:"bottom",children:[e(Ne,{children:e("div",{})}),e(Hn,{children:r!=""?e(C,{color:"danger",children:r}):e(C,{color:"success",children:"Valid Expression"})})]})]})}function lK(n){const{onAddFilterConditionSnippet:a}=n;return e(v,{width:"500px",paddingTop:"size-200",paddingStart:"size-200",paddingEnd:"size-200",borderRadius:"medium",borderWidth:"thin",borderColor:"light",backgroundColor:"light",children:o(Ye,{children:[e(ta,{label:"filter by substring",initialSnippet:"'search term' in output['key']",onAddFilterConditionSnippet:a},"substring"),e(ta,{label:"filter on errors",initialSnippet:"error is not None",onAddFilterConditionSnippet:a},"errors"),e(ta,{label:"filter by evaluation label",initialSnippet:"evals['hallucination'].label == 'hallucinated'",onAddFilterConditionSnippet:a},"eval_label"),e(ta,{label:"filter by evaluation score",initialSnippet:"evals['hallucination'].score >= 0.5",onAddFilterConditionSnippet:a},"eval_score"),e(ta,{label:"filter by evaluation explanation",initialSnippet:"'search term' in evals['hallucination'].explanation",onAddFilterConditionSnippet:a},"eval_explanation"),e(ta,{label:"filter for lower scores than first experiment",initialSnippet:"evals['hallucination'].score < experiments[0].evals['hallucination'].score",onAddFilterConditionSnippet:a},"compare_experiments"),e(ta,{label:"filter by metadata",initialSnippet:"metadata['category'] == 'hard_examples'",onAddFilterConditionSnippet:a},"metadata"),e(ta,{label:"filter by latency",initialSnippet:"latency_ms >= 10_000",onAddFilterConditionSnippet:a},"latency")]})})}function ta(n){const{initialSnippet:a,onAddFilterConditionSnippet:l}=n,[t,i]=m.useState(a),{theme:r}=Xn(),s=r==="light"?Ca:Fa;return e(ba,{label:n.label,children:o(b,{direction:"row",width:"100%",gap:"size-100",children:[e("div",{css:F(Eg,F`
|
|
6614
6614
|
flex: 1 1 auto;
|
|
6615
6615
|
`),children:e(Ka,{value:t,basicSetup:{lineNumbers:!1,foldGutter:!1,bracketMatching:!0,syntaxHighlighting:!0,highlightActiveLine:!1,highlightActiveLineGutter:!1},extensions:[xl()],editable:!0,onChange:i,theme:s,css:Rg})}),e(E,{"aria-label":"Add to filter condition",variant:"default",onPress:()=>l(t),leadingVisual:e(_,{svg:e(Nn,{})})})]})})}const qt={backgroundColor:"light",borderColor:"light",variant:"compact",collapsible:!0,bodyStyle:{padding:0}},tK=F`
|
|
6616
6616
|
flex: 1 1 auto;
|
|
@@ -6628,7 +6628,7 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
|
|
|
6628
6628
|
align-items: center;
|
|
6629
6629
|
color: var(--ac-global-color-primary);
|
|
6630
6630
|
gap: var(--ac-global-dimension-size-50);
|
|
6631
|
-
`;function rK(n){const{datasetId:a,experimentIds:l,displayFullText:t}=n,[i,r]=m.useState(""),[,s]=
|
|
6631
|
+
`;function rK(n){const{datasetId:a,experimentIds:l,displayFullText:t}=n,[i,r]=m.useState(""),[,s]=mn(),d=x.useLazyLoadQuery(_g,{experimentIds:l,datasetId:a,filterCondition:i}),c=m.useMemo(()=>{var I,D;return((D=(I=d.dataset)==null?void 0:I.experiments)==null?void 0:D.edges.reduce((T,L)=>{var V,w;return T[L.experiment.id]={...L.experiment,projectId:((w=(V=L.experiment)==null?void 0:V.project)==null?void 0:w.id)||null},T},{}))||{}},[d]),p=m.useMemo(()=>d.comparisons.map(I=>{const D=I.runComparisonItems.reduce((T,L)=>(T[L.experimentId]=L,T),{});return{...I,id:I.example.id,input:I.example.revision.input,referenceOutput:I.example.revision.referenceOutput,runComparisonMap:D}}),[d]),[y,u]=m.useState(null),g=m.useMemo(()=>[{header:"input",accessorKey:"input",cell:({row:I})=>e(kr,{controls:e(E,{size:"S","aria-label":"View example details",leadingVisual:e(_,{svg:e(hl,{})}),onPress:()=>{m.startTransition(()=>{u(e(m.Suspense,{children:e(Bi,{exampleId:I.original.example.id,onDismiss:()=>{u(null)}})}))})},children:"View Example"}),children:e(zl,{children:e(er,{children:e(Ga,{json:I.original.input,disableTitle:!0,space:t?2:0})})})})},{header:"reference output",accessorKey:"referenceOutput",cell:I=>e(zl,{children:t?cK(I):$a(I)})}],[t]),f=m.useMemo(()=>l.map(I=>({header:()=>{var w,$,M,N;const D=(w=c[I])==null?void 0:w.name,T=($=c[I])==null?void 0:$.metadata,L=(M=c[I])==null?void 0:M.projectId,V=((N=c[I])==null?void 0:N.sequenceNumber)||0;return o(b,{direction:"row",gap:"size-100",wrap:!0,alignItems:"center",justifyContent:"space-between",children:[o(b,{direction:"row",gap:"size-100",wrap:!0,alignItems:"center",children:[e(bt,{sequenceNumber:V}),e(C,{children:D})]}),e(ls,{experimentId:I,metadata:T,isQuiet:!0,projectId:L,canDeleteExperiment:!1})]})},accessorKey:I,minSize:500,cell:({row:D})=>{var j,q;const T=D.original.runComparisonMap[I],L=(T==null?void 0:T.runs.length)||0;if(L===0)return e(Yr,{});if(L>1)return e(C,{color:"warning",children:`${L} runs`});const V=T==null?void 0:T.runs[0];let w=null;const $=(j=V==null?void 0:V.trace)==null?void 0:j.traceId,M=(q=V==null?void 0:V.trace)==null?void 0:q.projectId;return $&&M&&(w=e(E,{variant:"default",className:"trace-button",size:"S","aria-label":"View run trace",leadingVisual:e(_,{svg:e(rt,{})}),onPress:()=>{m.startTransition(()=>{u(e(Ng,{traceId:$,projectId:M,title:"Experiment Run Trace"}))})},children:"View Trace"})),V?e(kr,{controls:o(J,{children:[e(E,{variant:"default",className:"expand-button",size:"S","aria-label":"View example run details",leadingVisual:e(_,{svg:e(hl,{})}),onPress:()=>{m.startTransition(()=>{u(e(uK,{selectedExample:D.original,datasetId:a,experimentInfoById:c}))})},children:"Experiment Run"}),w]}),children:e(zl,{children:e(dK,{...V,displayFullText:t,setDialog:u})})}):e(zl,{children:e(Yr,{})})}})),[l,c,a,t]),k=m.useMemo(()=>[...g,...f],[g,f]),h=Ke({columns:k,data:p,getCoreRowModel:Te(),columnResizeMode:"onChange"}),S=sn.useMemo(()=>{const I=h.getFlatHeaders(),D={};for(let T=0;T<I.length;T++){const L=I[T];D[`--header-${gl(L.id)}-size`]=L.getSize(),D[`--col-${gl(L.column.id)}-size`]=L.column.getSize()}return D},[h.getState().columnSizingInfo,h.getState().columnSizing]),P=h.getRowModel().rows.length===0;return e(v,{overflow:"auto",children:o(b,{direction:"column",height:"100%",children:[e(v,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:e(aK,{onValidCondition:r})}),o("div",{css:tK,children:[o("table",{css:F(He,Mo),style:{...S,width:h.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:h.getHeaderGroups().map(I=>e("tr",{children:I.headers.map(D=>e("th",{colSpan:D.colSpan,style:{width:`calc(var(--header-${gl(D==null?void 0:D.id)}-size) * 1px)`},children:D.isPlaceholder?null:o(J,{children:[o("div",{className:D.column.getCanSort()?"cursor-pointer":"",onClick:D.column.getToggleSortingHandler(),style:{left:D.getStart(),width:"100%"},children:[e(dn,{maxWidth:"100%",children:W(D.column.columnDef.header,D.getContext())}),D.column.getIsSorted()?e(_,{className:"sort-icon",svg:D.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]}),e("div",{onMouseDown:D.getResizeHandler(),onTouchStart:D.getResizeHandler(),className:`resizer ${D.column.getIsResizing()?"isResizing":""}`})]})},D.id))},I.id))}),P?e(tn,{}):h.getState().columnSizingInfo.isResizingColumn?e(oK,{table:h}):e(Mg,{table:h})]}),e(re,{isDismissable:!0,type:"slideOver",onDismiss:()=>{u(null),s(I=>(I.delete(un),I))},children:y})]})]})})}function Mg({table:n}){return e("tbody",{children:n.getRowModel().rows.map(a=>e("tr",{children:a.getVisibleCells().map(l=>e("td",{style:{width:`calc(var(--col-${gl(l.column.id)}-size) * 1px)`,maxWidth:`calc(var(--col-${gl(l.column.id)}-size) * 1px)`,padding:0},children:W(l.column.columnDef.cell,l.getContext())},l.id))},a.id))})}const oK=sn.memo(Mg,(n,a)=>n.table.options.data===a.table.options.data);function sK(n){const{datasetId:a,exampleId:l}=n,t=ce();return e("div",{onClick:i=>{i.preventDefault(),i.stopPropagation()},children:e(zn,{buttonSize:"compact",align:"end",onAction:i=>{switch(i){case"gotoExample":return t(`/datasets/${a}/examples/${l}`);default:Pe()}},children:e(ue,{children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(uh,{})}),e(C,{children:"Go to example"})]})},"gotoExample")})})}function dK(n){const{output:a,error:l,startTime:t,endTime:i,annotations:r,displayFullText:s,setDialog:d}=n;if(l)return e(Vg,{error:l});const c=r!=null&&r.edges.length?r.edges.map(p=>p.annotation):[];return o(b,{direction:"column",gap:"size-100",height:"100%",justifyContent:"space-between",children:[e(er,{children:e(Ga,{json:a,disableTitle:!0,space:s?2:0})}),o("ul",{css:F`
|
|
6632
6632
|
display: flex;
|
|
6633
6633
|
flex-direction: row;
|
|
6634
6634
|
gap: var(--ac-global-dimension-static-size-100);
|
|
@@ -6640,7 +6640,7 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
|
|
|
6640
6640
|
`,children:n})}function uK({selectedExample:n,datasetId:a,experimentInfoById:l}){return e(te,{title:`Comparing Experiments for Example: ${n.id}`,size:"fullscreen",extra:e(sK,{datasetId:a,exampleId:n.id}),children:o(Pn,{direction:"vertical",autoSaveId:"example-compare-panel-group",children:[e(Re,{defaultSize:35,children:e("div",{css:F`
|
|
6641
6641
|
overflow-y: auto;
|
|
6642
6642
|
height: 100%;
|
|
6643
|
-
`,children:e(v,{overflow:"hidden",padding:"size-200",children:o(b,{direction:"row",gap:"size-200",flex:"1 1 auto",children:[e(v,{width:"50%",children:e(B,{title:"Input",...qt,bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},extra:e(de,{text:JSON.stringify(n.input)}),children:e(
|
|
6643
|
+
`,children:e(v,{overflow:"hidden",padding:"size-200",children:o(b,{direction:"row",gap:"size-200",flex:"1 1 auto",children:[e(v,{width:"50%",children:e(B,{title:"Input",...qt,bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},extra:e(de,{text:JSON.stringify(n.input)}),children:e(hn,{value:JSON.stringify(n.input,null,2)})})}),e(v,{width:"50%",children:e(B,{title:"Reference Output",...qt,extra:e(de,{text:JSON.stringify(n.referenceOutput)}),bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},children:e(hn,{value:JSON.stringify(n.referenceOutput,null,2)})})})]})})})}),e(Rn,{css:Ha}),e(Re,{defaultSize:65,children:o(b,{direction:"column",height:"100%",children:[e(v,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:e(ae,{level:2,children:"Experiments"})}),e("div",{css:F`
|
|
6644
6644
|
overflow-y: auto;
|
|
6645
6645
|
height: 100%;
|
|
6646
6646
|
padding: var(--ac-global-dimension-static-size-200);
|
|
@@ -6648,7 +6648,7 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
|
|
|
6648
6648
|
display: flex;
|
|
6649
6649
|
flex-direction: column;
|
|
6650
6650
|
gap: var(--ac-global-dimension-static-size-200);
|
|
6651
|
-
`,children:n.runComparisonItems.map(t=>{const i=l[t.experimentId];return e("li",{children:e(B,{...qt,title:i==null?void 0:i.name,titleExtra:e(bt,{sequenceNumber:(i==null?void 0:i.sequenceNumber)||0}),children:e("ul",{children:t.runs.map((r,s)=>{var d;return e("li",{children:o(b,{direction:"row",children:[e(v,{flex:!0,children:r.error?e(v,{padding:"size-200",children:e(Vg,{error:r.error})}):e(
|
|
6651
|
+
`,children:n.runComparisonItems.map(t=>{const i=l[t.experimentId];return e("li",{children:e(B,{...qt,title:i==null?void 0:i.name,titleExtra:e(bt,{sequenceNumber:(i==null?void 0:i.sequenceNumber)||0}),children:e("ul",{children:t.runs.map((r,s)=>{var d;return e("li",{children:o(b,{direction:"row",children:[e(v,{flex:!0,children:r.error?e(v,{padding:"size-200",children:e(Vg,{error:r.error})}):e(hn,{value:JSON.stringify(r.output,null,2)})}),o(xa,{width:"size-3000",children:[e(zg,{startTime:r.startTime,endTime:r.endTime}),e("ul",{css:F`
|
|
6652
6652
|
margin-top: var(
|
|
6653
6653
|
--ac-global-dimension-static-size-100
|
|
6654
6654
|
);
|
|
@@ -6659,7 +6659,7 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
|
|
|
6659
6659
|
gap: var(
|
|
6660
6660
|
--ac-global-dimension-static-size-100
|
|
6661
6661
|
);
|
|
6662
|
-
`,children:(d=r.annotations)==null?void 0:d.edges.map(c=>e("li",{children:e(Ua,{annotation:c.annotation})},c.annotation.id))})]})]})},s)})})})},t.experimentId)})})})]})})]})})}function Ng({traceId:n,projectId:a,title:l}){const t=ce();return e(te,{title:l,size:"fullscreen",extra:e(E,{onPress:()=>t(`/projects/${a}/traces/${n}`),children:"View Trace in Project"}),children:e(Hi,{traceId:n,projectId:a})})}function zl({children:n}){return e(v,{paddingX:"size-200",paddingY:"size-100",children:n})}const $g={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ExperimentMultiSelector__experiments",selections:[{alias:null,args:null,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Dataset",abstractKey:null};$g.hash="1aa376b1e9425f49268ac231dc2c0412";function mK(n){const{dataset:a,selectedExperimentIds:l,onChange:t,label:i,validationState:r,description:s,errorMessage:d,...c}=n,p=x.useFragment($g,a),y=m.useMemo(()=>p.experiments.edges.map(f=>f.experiment),[p]),u=y.length===0,g=m.useMemo(()=>{if(u)return"No experiments";const f=l.length;return f>0?`${f} experiment${f>1?"s":""}`:"No experiments selected"},[l,u]);return e(ba,{label:i,isDisabled:u,validationState:r,description:s,errorMessage:d,children:e(ui,{isDisabled:u,...c,menu:e(Yl,{selectionMode:"multiple",onSelectionChange:f=>{t(Array.from(f))},selectedKeys:new Set(l),children:y.map(f=>e(ue,{textValue:f.name,children:o(b,{direction:"column",gap:"size-50",children:[o(b,{direction:"row",gap:"size-100",children:[e(bt,{sequenceNumber:f.sequenceNumber}),e(C,{children:f.name})]}),e(C,{size:"XS",color:"text-700",children:new Date(f.createdAt).toLocaleString()})]})},f.id))}),triggerProps:{placement:"bottom start"},children:g})})}function GT(){const n=Me();je(n);const[a,l]=m.useState(!1),[t,i]=
|
|
6662
|
+
`,children:(d=r.annotations)==null?void 0:d.edges.map(c=>e("li",{children:e(Ua,{annotation:c.annotation})},c.annotation.id))})]})]})},s)})})})},t.experimentId)})})})]})})]})})}function Ng({traceId:n,projectId:a,title:l}){const t=ce();return e(te,{title:l,size:"fullscreen",extra:e(E,{onPress:()=>t(`/projects/${a}/traces/${n}`),children:"View Trace in Project"}),children:e(Hi,{traceId:n,projectId:a})})}function zl({children:n}){return e(v,{paddingX:"size-200",paddingY:"size-100",children:n})}const $g={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ExperimentMultiSelector__experiments",selections:[{alias:null,args:null,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Dataset",abstractKey:null};$g.hash="1aa376b1e9425f49268ac231dc2c0412";function mK(n){const{dataset:a,selectedExperimentIds:l,onChange:t,label:i,validationState:r,description:s,errorMessage:d,...c}=n,p=x.useFragment($g,a),y=m.useMemo(()=>p.experiments.edges.map(f=>f.experiment),[p]),u=y.length===0,g=m.useMemo(()=>{if(u)return"No experiments";const f=l.length;return f>0?`${f} experiment${f>1?"s":""}`:"No experiments selected"},[l,u]);return e(ba,{label:i,isDisabled:u,validationState:r,description:s,errorMessage:d,children:e(ui,{isDisabled:u,...c,menu:e(Yl,{selectionMode:"multiple",onSelectionChange:f=>{t(Array.from(f))},selectedKeys:new Set(l),children:y.map(f=>e(ue,{textValue:f.name,children:o(b,{direction:"column",gap:"size-50",children:[o(b,{direction:"row",gap:"size-100",children:[e(bt,{sequenceNumber:f.sequenceNumber}),e(C,{children:f.name})]}),e(C,{size:"XS",color:"text-700",children:new Date(f.createdAt).toLocaleString()})]})},f.id))}),triggerProps:{placement:"bottom start"},children:g})})}function GT(){const n=Me();je(n);const[a,l]=m.useState(!1),[t,i]=mn(),r=t.getAll("experimentId"),s=r.length>0;return o("main",{css:F`
|
|
6663
6663
|
height: 100%;
|
|
6664
6664
|
display: flex;
|
|
6665
6665
|
flex-direction: column;
|
|
@@ -6818,7 +6818,7 @@ fragment DBUsagePieChart_data on Query {
|
|
|
6818
6818
|
gap: var(--ac-global-dimension-size-100);
|
|
6819
6819
|
flex-wrap: wrap;
|
|
6820
6820
|
justify-content: center;
|
|
6821
|
-
`;function YT(){const n=!window.Config.basicAuthDisabled,a=window.Config.oAuth2Idps,l=a.length>0,[t,i]=
|
|
6821
|
+
`;function YT(){const n=!window.Config.basicAuthDisabled,a=window.Config.oAuth2Idps,l=a.length>0,[t,i]=mn(),r=t.get("returnUrl"),s=t.get("message"),d=t.get("trigger"),c=m.useRef({});return m.useEffect(()=>{var p;if(d&&l){const y=a.find(u=>u.name.toLowerCase()===d.toLowerCase());y&&c.current[y.name]&&((p=c.current[y.name])==null||p.submit())}},[d,l,a]),o(_l,{children:[e(b,{direction:"column",gap:"size-200",alignItems:"center",children:e(v,{paddingBottom:"size-200",children:e(Dt,{})})}),s&&e(v,{paddingBottom:"size-100",children:e(Fe,{variant:"success",children:s})}),n&&e(yK,{initialError:t.get("error"),onSubmit:()=>{i(p=>{const y=new URLSearchParams(p);return y.delete("message"),y.delete("error"),y})}}),n&&l?e("div",{css:kK,children:"or"}):null,l&&e(J,{children:e("ul",{css:bK,children:a.map(p=>e("li",{children:e(Qg,{idpName:p.name,idpDisplayName:p.displayName,returnUrl:r,ref:y=>{c.current[p.name]=y}},p.name)},p.name))})})]})}const Bg=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchViewer",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ResetPasswordFormMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ResetPasswordFormMutation",selections:a},params:{cacheID:"d09af5e3a2a3d10f117373e25bef11e6",id:null,metadata:{},name:"ResetPasswordFormMutation",operationKind:"mutation",text:`mutation ResetPasswordFormMutation(
|
|
6822
6822
|
$input: PatchViewerInput!
|
|
6823
6823
|
) {
|
|
6824
6824
|
patchViewer(input: $input) {
|
|
@@ -6839,7 +6839,7 @@ fragment DBUsagePieChart_data on Query {
|
|
|
6839
6839
|
button {
|
|
6840
6840
|
width: 100%;
|
|
6841
6841
|
}
|
|
6842
|
-
`,children:e(E,{variant:p?"primary":"default",type:"submit",isDisabled:i,children:i?"Resetting...":"Reset Password"})})]})]})}function nP(){const n=ce(),[a]=
|
|
6842
|
+
`,children:e(E,{variant:p?"primary":"default",type:"submit",isDisabled:i,children:i?"Resetting...":"Reset Password"})})]})]})}function nP(){const n=ce(),[a]=mn(),l=a.get("token");return l?o(_l,{children:[e(b,{direction:"column",gap:"size-200",alignItems:"center",children:e(v,{paddingBottom:"size-200",children:e(Dt,{})})}),e(CK,{resetToken:l}),e(v,{paddingTop:"size-200",children:e(b,{direction:"column",alignItems:"center",justifyContent:"center",children:e(we,{to:"/login",children:"Back to Login"})})})]}):(n("/login"),null)}const Ug=function(){var n={alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"resetPasswordLoaderQuery",selections:[n,{args:null,kind:"FragmentSpread",name:"ResetPasswordFormQuery"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"resetPasswordLoaderQuery",selections:[n]},params:{cacheID:"3f2aa2ea2629970ac6ca3c4fa86f1f7b",id:null,metadata:{},name:"resetPasswordLoaderQuery",operationKind:"query",text:`query resetPasswordLoaderQuery {
|
|
6843
6843
|
viewer {
|
|
6844
6844
|
id
|
|
6845
6845
|
email
|
|
@@ -6874,7 +6874,7 @@ fragment ResetPasswordFormQuery on Query {
|
|
|
6874
6874
|
gap: var(--ac-global-dimension-size-100);
|
|
6875
6875
|
flex-wrap: wrap;
|
|
6876
6876
|
justify-content: center;
|
|
6877
|
-
`;function tP(){const n=window.Config.oAuth2Idps,a=n.length>0,[l]=
|
|
6877
|
+
`;function tP(){const n=window.Config.oAuth2Idps,a=n.length>0,[l]=mn(),t=l.get("returnUrl"),i=!window.Config.basicAuthDisabled,r=l.get("error");return o(_l,{children:[e(b,{direction:"column",gap:"size-200",alignItems:"center",children:e(v,{paddingBottom:"size-200",children:e(Dt,{})})}),e(v,{paddingBottom:"size-100",children:e(Fe,{variant:r?"danger":"success",children:r||"You have been logged out"})}),i&&e(v,{paddingY:"size-100",children:e(Wn,{to:"/login",children:"Back to login"})}),a&&e("ul",{css:KK,children:n.slice(0,1).map(s=>e("li",{children:e(Qg,{idpName:s.name,idpDisplayName:s.displayName,returnUrl:t},s.name)},s.name))})]})}const Hg=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],l={alias:null,args:null,kind:"ScalarField",name:"jwt",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ViewerAPIKeysCreateUserAPIKeyMutation",selections:[{alias:null,args:a,concreteType:"CreateUserApiKeyMutationPayload",kind:"LinkedField",name:"createUserApiKey",plural:!1,selections:[l,{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"apiKey",plural:!1,selections:[t,{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"APIKeysTableFragment"}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ViewerAPIKeysCreateUserAPIKeyMutation",selections:[{alias:null,args:a,concreteType:"CreateUserApiKeyMutationPayload",kind:"LinkedField",name:"createUserApiKey",plural:!1,selections:[l,{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"apiKey",plural:!1,selections:[t,{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"apiKeys",plural:!0,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null},t],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"500fa7541c393ca91d6fa184c5626b44",id:null,metadata:{},name:"ViewerAPIKeysCreateUserAPIKeyMutation",operationKind:"mutation",text:`mutation ViewerAPIKeysCreateUserAPIKeyMutation(
|
|
6878
6878
|
$input: CreateUserApiKeyInput!
|
|
6879
6879
|
) {
|
|
6880
6880
|
createUserApiKey(input: $input) {
|
|
@@ -6944,7 +6944,7 @@ fragment APIKeysTableFragment on User {
|
|
|
6944
6944
|
}
|
|
6945
6945
|
id
|
|
6946
6946
|
}
|
|
6947
|
-
`}}}();Wg.hash="6c32098d55e4cba859dcec73f3ccd28c";const Jg=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:Wg,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"APIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"apiKeys",plural:!0,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null},n],type:"User",abstractKey:null}}();Jg.hash="6c32098d55e4cba859dcec73f3ccd28c";const ao=70;function TK({query:n}){const[a,l]=x.useRefetchableFragment(Jg,n),t=me(),[i]=x.useMutation(Gg),r=m.useCallback(u=>{i({variables:{input:{id:u}},onCompleted:()=>{t({title:"API key deleted",message:"The key has been deleted and is no longer active."}),m.startTransition(()=>{l({},{fetchPolicy:"network-only"})})}})},[i,t,l]),s=m.useMemo(()=>[...a.apiKeys],[a]),d=m.useMemo(()=>[{header:"Name",accessorKey:"name",size:100,cell:Ee},{header:"Description",accessorKey:"description",cell:Ee},{header:"Created At",accessorKey:"createdAt",size:ao,cell:_e},{header:"Expires At",accessorKey:"expiresAt",size:ao,cell:_e},{header:"",accessorKey:"id",size:10,cell:({row:g})=>e(b,{direction:"row",justifyContent:"end",width:"100%",children:e(yi,{handleDelete:()=>{r(g.original.id)}})}),meta:{textAlign:"right"}}],[r]),c=Ke({columns:d,data:s,getCoreRowModel:Te()}),p=c.getRowModel().rows,y=c.getRowModel().rows.length===0;return o("table",{css:
|
|
6947
|
+
`}}}();Wg.hash="6c32098d55e4cba859dcec73f3ccd28c";const Jg=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:Wg,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"APIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"apiKeys",plural:!0,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null},n],type:"User",abstractKey:null}}();Jg.hash="6c32098d55e4cba859dcec73f3ccd28c";const ao=70;function TK({query:n}){const[a,l]=x.useRefetchableFragment(Jg,n),t=me(),[i]=x.useMutation(Gg),r=m.useCallback(u=>{i({variables:{input:{id:u}},onCompleted:()=>{t({title:"API key deleted",message:"The key has been deleted and is no longer active."}),m.startTransition(()=>{l({},{fetchPolicy:"network-only"})})}})},[i,t,l]),s=m.useMemo(()=>[...a.apiKeys],[a]),d=m.useMemo(()=>[{header:"Name",accessorKey:"name",size:100,cell:Ee},{header:"Description",accessorKey:"description",cell:Ee},{header:"Created At",accessorKey:"createdAt",size:ao,cell:_e},{header:"Expires At",accessorKey:"expiresAt",size:ao,cell:_e},{header:"",accessorKey:"id",size:10,cell:({row:g})=>e(b,{direction:"row",justifyContent:"end",width:"100%",children:e(yi,{handleDelete:()=>{r(g.original.id)}})}),meta:{textAlign:"right"}}],[r]),c=Ke({columns:d,data:s,getCoreRowModel:Te()}),p=c.getRowModel().rows,y=c.getRowModel().rows.length===0;return o("table",{css:He,children:[e("thead",{children:c.getHeaderGroups().map(u=>e("tr",{children:u.headers.map(g=>e("th",{colSpan:g.colSpan,children:g.isPlaceholder?null:o("div",{className:g.column.getCanSort()?"cursor-pointer":"",onClick:g.column.getToggleSortingHandler(),style:{left:g.getStart(),width:g.getSize()},children:[W(g.column.columnDef.header,g.getContext()),g.column.getIsSorted()?e(_,{className:"sort-icon",svg:g.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]})},g.id))},u.id))}),y?e(tn,{message:"No Keys"}):e("tbody",{children:p.map(u=>e("tr",{children:u.getVisibleCells().map(g=>e("td",{children:W(g.column.columnDef.cell,g.getContext())},g.id))},u.id))})]})}function PK({viewer:n}){const[a,l]=m.useState(null),t=ke(),[i,r]=x.useMutation(Hg),s=m.useCallback(d=>{var c;i({variables:{input:{...d,expiresAt:((c=d.expiresAt)==null?void 0:c.toDate(ti()).toISOString())||null}},onCompleted:p=>{l(e(po,{jwt:p.createUserApiKey.jwt}))},onError:p=>{t({title:"Error creating API key",message:p.message})}})},[i,t]);return o(B,{title:"API Keys",variant:"compact",bodyStyle:{padding:0},extra:e(E,{size:"S",leadingVisual:e(_,{svg:e(Nn,{})}),onPress:()=>l(e(yo,{onSubmit:s,isCommitting:r})),children:"New Key"}),children:[e(TK,{query:n}),e(re,{onDismiss:()=>{l(null)},children:a})]})}const Zg=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchViewer",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ViewerProfileCardMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ViewerProfileCardMutation",selections:a},params:{cacheID:"03f161df42c71b5924a8ee665e01cdce",id:null,metadata:{},name:"ViewerProfileCardMutation",operationKind:"mutation",text:`mutation ViewerProfileCardMutation(
|
|
6948
6948
|
$input: PatchViewerInput!
|
|
6949
6949
|
) {
|
|
6950
6950
|
patchViewer(input: $input) {
|
|
@@ -6961,7 +6961,7 @@ fragment APIKeysTableFragment on User {
|
|
|
6961
6961
|
width: 100%;
|
|
6962
6962
|
margin-left: auto;
|
|
6963
6963
|
margin-right: auto;
|
|
6964
|
-
`;function iP(){const{viewer:n}=fi();return n?e("main",{css:IK,children:e("div",{css:DK,children:o(b,{direction:"column",gap:"size-200",children:[e(xK,{}),e(PK,{viewer:n})]})})}):null}function rP(){return e(Ji,{})}function oP(){const n=Me();je(n);const a=m.useMemo(()=>n.span.__typename==="Span"?n.span:null,[n.span]);if(!a)throw new Error("Span not found");const{playgroundInstance:l,parsingErrors:t,playgroundInput:i}=m.useMemo(()=>t0(a),[a]),r=i!=null?{input:i}:{};return o(b,{direction:"column",height:"100%",children:[e(LK,{span:a,parsingErrors:t}),e(Ji,{instances:[l],...r},a.id)]})}function LK({span:n,parsingErrors:a}){const l=ce(),t=a&&a.length>0,[i,r]=m.useState(!0),[s,d]=m.useState(t);return o(b,{direction:"column",children:[i&&e(Fe,{variant:"info",title:"LLM Span Replay",banner:!0,dismissable:!0,onDismissClick:()=>{r(!1)},extra:e(E,{leadingVisual:e(_,{svg:e(ph,{})}),onPress:()=>{l(`/projects/${n.project.id}/traces/${n.trace.traceId}?${
|
|
6964
|
+
`;function iP(){const{viewer:n}=fi();return n?e("main",{css:IK,children:e("div",{css:DK,children:o(b,{direction:"column",gap:"size-200",children:[e(xK,{}),e(PK,{viewer:n})]})})}):null}function rP(){return e(Ji,{})}function oP(){const n=Me();je(n);const a=m.useMemo(()=>n.span.__typename==="Span"?n.span:null,[n.span]);if(!a)throw new Error("Span not found");const{playgroundInstance:l,parsingErrors:t,playgroundInput:i}=m.useMemo(()=>t0(a),[a]),r=i!=null?{input:i}:{};return o(b,{direction:"column",height:"100%",children:[e(LK,{span:a,parsingErrors:t}),e(Ji,{instances:[l],...r},a.id)]})}function LK({span:n,parsingErrors:a}){const l=ce(),t=a&&a.length>0,[i,r]=m.useState(!0),[s,d]=m.useState(t);return o(b,{direction:"column",children:[i&&e(Fe,{variant:"info",title:"LLM Span Replay",banner:!0,dismissable:!0,onDismissClick:()=>{r(!1)},extra:e(E,{leadingVisual:e(_,{svg:e(ph,{})}),onPress:()=>{l(`/projects/${n.project.id}/traces/${n.trace.traceId}?${un}=${n.id}`)},children:"Back to Trace"}),children:`Replay and iterate on your LLM call from your ${n.project.name} project`}),s&&t&&e(Fe,{variant:"warning",banner:!0,dismissable:!0,onDismissClick:()=>{d(!1)},title:"The following errors occurred when parsing span attributes:",children:e("ul",{children:a.map(c=>e("li",{children:c},c))})})]})}const Xg=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"spanId"}],a=[{kind:"Variable",name:"id",variableName:"spanId"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},s={alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"attributes",storageKey:null},c=[{alias:null,args:null,kind:"ScalarField",name:"invocationInputField",storageKey:null}],p={alias:null,args:null,concreteType:null,kind:"LinkedField",name:"invocationParameters",plural:!0,selections:[l,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"invocationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"canonicalName",storageKey:null}],type:"InvocationParameterBase",abstractKey:"__isInvocationParameterBase"},{kind:"InlineFragment",selections:c,type:"BooleanInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:c,type:"StringInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:c,type:"BoundedFloatInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:c,type:"FloatInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:c,type:"IntInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:c,type:"JSONInvocationParameter",abstractKey:null},{kind:"InlineFragment",selections:c,type:"StringListInvocationParameter",abstractKey:null}],storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"spanPlaygroundPageLoaderQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[t,i,r,s,d,p],type:"Span",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"spanPlaygroundPageLoaderQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{kind:"InlineFragment",selections:[i,r,s,d,p],type:"Span",abstractKey:null}],storageKey:null}]},params:{cacheID:"15db907b4e1020d0625053f7530561ad",id:null,metadata:{},name:"spanPlaygroundPageLoaderQuery",operationKind:"query",text:`query spanPlaygroundPageLoaderQuery(
|
|
6965
6965
|
$spanId: ID!
|
|
6966
6966
|
) {
|
|
6967
6967
|
span: node(id: $spanId) {
|
|
@@ -7078,10 +7078,10 @@ fragment PromptsTable_prompts on Query {
|
|
|
7078
7078
|
}
|
|
7079
7079
|
}
|
|
7080
7080
|
}
|
|
7081
|
-
`}}}();np.hash="af218c6f8442ad552dd44771a2d55275";function _K({promptId:n,onDeleted:a,onClose:l}){const[t,i]=x.useMutation(np),r=me(),s=ke(),d=m.useCallback(()=>{t({variables:{promptId:n},onCompleted:()=>{r({title:"Delete Successful",message:"Prompt has been deleted."}),a(),l()},onError:c=>{s({title:"Failed to delete prompt",message:c.message})}})},[t,s,r,l,a,n]);return o(te,{title:"Delete Prompt",isDismissable:!0,onDismiss:l,children:[e(v,{padding:"size-200",children:e(C,{color:"danger",children:"Are you sure you want to delete this prompt? This action cannot be undone and all services dependent on this prompt will be affected."})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:o(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",onPress:l,size:"S",children:"Cancel"}),e(E,{variant:"danger",onPress:()=>{d()},size:"S",isDisabled:i,children:"Delete Prompt"})]})})]})}function AK({onDeleted:n,promptId:a}){const[l,t]=m.useState(null),i=m.useCallback(()=>{t(e(_K,{promptId:a,onClose:()=>t(null),onDeleted:()=>{n(),t(null)}}))},[a,n]);return o(Tl,{children:[e(zn,{align:"end","aria-label":"User Actions",buttonSize:"compact",onAction:r=>{switch(r){case"DELETE":i();break}},children:e(ue,{children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(
|
|
7081
|
+
`}}}();np.hash="af218c6f8442ad552dd44771a2d55275";function _K({promptId:n,onDeleted:a,onClose:l}){const[t,i]=x.useMutation(np),r=me(),s=ke(),d=m.useCallback(()=>{t({variables:{promptId:n},onCompleted:()=>{r({title:"Delete Successful",message:"Prompt has been deleted."}),a(),l()},onError:c=>{s({title:"Failed to delete prompt",message:c.message})}})},[t,s,r,l,a,n]);return o(te,{title:"Delete Prompt",isDismissable:!0,onDismiss:l,children:[e(v,{padding:"size-200",children:e(C,{color:"danger",children:"Are you sure you want to delete this prompt? This action cannot be undone and all services dependent on this prompt will be affected."})}),e(v,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:o(b,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(E,{variant:"default",onPress:l,size:"S",children:"Cancel"}),e(E,{variant:"danger",onPress:()=>{d()},size:"S",isDisabled:i,children:"Delete Prompt"})]})})]})}function AK({onDeleted:n,promptId:a}){const[l,t]=m.useState(null),i=m.useCallback(()=>{t(e(_K,{promptId:a,onClose:()=>t(null),onDeleted:()=>{n(),t(null)}}))},[a,n]);return o(Tl,{children:[e(zn,{align:"end","aria-label":"User Actions",buttonSize:"compact",onAction:r=>{switch(r){case"DELETE":i();break}},children:e(ue,{children:o(b,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(_,{svg:e(Ge,{})}),e(J,{children:"Delete"})]})},"DELETE")}),e(re,{type:"modal",isDismissable:!0,onDismiss:()=>t(null),children:l})]})}const wK=100;function RK(n){const a=ce(),l=m.useRef(null),{data:t,loadNext:i,hasNext:r,isLoadingNext:s,refetch:d}=x.usePaginationFragment(ep,n.query),c=m.useMemo(()=>t.prompts.edges.map(k=>({lastUpdatedAt:k.prompt.version.createdAt,...k.prompt})),[t]),p=m.useCallback(k=>{if(k){const{scrollHeight:h,scrollTop:S,clientHeight:K}=k;h-S-K<300&&!s&&r&&i(wK)}},[r,s,i]),y=m.useMemo(()=>[{header:"name",accessorKey:"name",cell:({row:h})=>e(we,{to:`${h.original.id}`,children:h.original.name})},{header:"description",accessorKey:"description",cell:Ee},{header:"created at",accessorKey:"createdAt",cell:_e},{header:"last updated",accessorKey:"lastUpdatedAt",cell:_e},{id:"actions",header:"",size:5,accessorKey:"id",cell:({row:h})=>o(b,{direction:"row",gap:"size-100",justifyContent:"end",width:"100%",children:[e(Tl,{children:e(Wn,{leadingVisual:e(_,{svg:e(wa,{})}),size:"S","aria-label":"Open in playground",to:`${h.original.id}/playground`,children:"Playground"})}),e(AK,{promptId:h.original.id,onDeleted:()=>{d({},{fetchPolicy:"network-only"})}})]})}],[d]),u=Ke({columns:y,data:c,getCoreRowModel:Te(),getSortedRowModel:ln()}),g=u.getRowModel().rows,f=g.length===0;return e("div",{css:F`
|
|
7082
7082
|
flex: 1 1 auto;
|
|
7083
7083
|
overflow: auto;
|
|
7084
|
-
`,onScroll:k=>p(k.target),ref:l,children:o("table",{css:$n,children:[e("thead",{children:u.getHeaderGroups().map(k=>e("tr",{children:k.headers.map(h=>{var S;return e("th",{colSpan:h.colSpan,children:h.isPlaceholder?null:o("div",{className:h.column.getCanSort()?"cursor-pointer":"","aria-role":h.column.getCanSort()?"button":null,onClick:h.column.getToggleSortingHandler(),style:{textAlign:(S=h.column.columnDef.meta)==null?void 0:S.textAlign},children:[W(h.column.columnDef.header,h.getContext()),h.column.getIsSorted()?e(_,{className:"sort-icon",svg:h.column.getIsSorted()==="asc"?e(
|
|
7084
|
+
`,onScroll:k=>p(k.target),ref:l,children:o("table",{css:$n,children:[e("thead",{children:u.getHeaderGroups().map(k=>e("tr",{children:k.headers.map(h=>{var S;return e("th",{colSpan:h.colSpan,children:h.isPlaceholder?null:o("div",{className:h.column.getCanSort()?"cursor-pointer":"","aria-role":h.column.getCanSort()?"button":null,onClick:h.column.getToggleSortingHandler(),style:{textAlign:(S=h.column.columnDef.meta)==null?void 0:S.textAlign},children:[W(h.column.columnDef.header,h.getContext()),h.column.getIsSorted()?e(_,{className:"sort-icon",svg:h.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]})},h.id)})},k.id))}),f?e(tn,{}):e("tbody",{children:g.map(k=>e("tr",{onClick:()=>{a(`${k.original.id}`)},children:k.getVisibleCells().map(h=>{var S;return e("td",{align:(S=h.column.columnDef.meta)==null?void 0:S.textAlign,children:W(h.column.columnDef.cell,h.getContext())},h.id)})},k.id))})]})})}function dP(){const n=Me();return je(n),o(b,{direction:"column",height:"100%",children:[e(v,{padding:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",flex:"none",children:o(b,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(ae,{level:1,children:"Prompts"}),e(Wn,{size:"M",leadingVisual:e(_,{svg:e(hi,{})}),variant:"primary",to:"/playground",children:"Create Prompt"})]})}),e(RK,{query:n})]})}const ap=function(){var n=[{kind:"Literal",name:"first",value:100}],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"promptsLoaderQuery",selections:[{args:null,kind:"FragmentSpread",name:"PromptsTable_prompts"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"promptsLoaderQuery",selections:[{alias:null,args:n,concreteType:"PromptConnection",kind:"LinkedField",name:"prompts",plural:!1,selections:[{alias:null,args:null,concreteType:"PromptEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"prompt",args:null,concreteType:"Prompt",kind:"LinkedField",name:"node",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},l,{alias:null,args:null,concreteType:"PromptVersion",kind:"LinkedField",name:"version",plural:!1,selections:[l,a],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Prompt",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},a],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:"prompts(first:100)"},{alias:null,args:n,filters:null,handle:"connection",key:"PromptsTable_prompts",kind:"LinkedHandle",name:"prompts"}]},params:{cacheID:"9a3e6a185a7a63d9d2c115e80e22b495",id:null,metadata:{},name:"promptsLoaderQuery",operationKind:"query",text:`query promptsLoaderQuery {
|
|
7085
7085
|
...PromptsTable_prompts
|
|
7086
7086
|
}
|
|
7087
7087
|
|
|
@@ -7362,7 +7362,7 @@ fragment PromptVersionTagsConfigCard_data on Prompt {
|
|
|
7362
7362
|
promptVersionId
|
|
7363
7363
|
}
|
|
7364
7364
|
}
|
|
7365
|
-
`}}}();ip.hash="58fa5b2b6e7af186229c70b90082644a";function EK({promptVersionTagId:n,promptId:a}){const[l,t]=m.useState(!1),i=me(),[r,s]=x.useMutation(ip);return o(
|
|
7365
|
+
`}}}();ip.hash="58fa5b2b6e7af186229c70b90082644a";function EK({promptVersionTagId:n,promptId:a}){const[l,t]=m.useState(!1),i=me(),[r,s]=x.useMutation(ip);return o(Ue,{isOpen:l,onOpenChange:t,children:[e(E,{"aria-label":"Delete tag",size:"S",leadingVisual:e(_,{svg:e(Ge,{})})}),e(yn,{size:"S",isDismissable:!0,children:o(pn,{children:[e(ae,{slot:"title",children:"Delete Tag"}),e(v,{padding:"size-200",children:e(v,{paddingBottom:"size-100",children:e(C,{color:"danger",size:"XS",children:"Are you sure you want to delete this tag? This will make pulling prompts by this tag no longer possible. Make sure this tag is not used before deleting."})})}),e(v,{paddingX:"size-200",paddingY:"size-100",borderTopWidth:"thin",borderColor:"light",children:o(b,{gap:"size-100",justifyContent:"end",children:[e(E,{size:"S",onPress:()=>t(!1),children:"Cancel"}),e(E,{variant:"danger",size:"S",onPress:()=>r({variables:{input:{promptVersionTagId:n},promptId:a},onCompleted:()=>{i({title:"Tag Deleted",message:"The tag has been deleted"})}}),children:s?"Deleting...":"Delete Tag"})]})})]})})]})}function MK({prompt:n}){const a=x.useFragment(tp,n),l=m.useMemo(()=>[{header:"Name",accessorKey:"name"},{header:"Description",accessorKey:"description",cell:Ee},{header:"Version",accessorKey:"promptVersionId",cell:({row:d})=>{const{promptId:c,promptVersionId:p}=d.original;return e(we,{to:`/prompts/${c}/versions/${p}`,children:d.original.promptVersionId})}},{id:"actions",header:"",size:5,accessorKey:"id",cell:({row:d})=>e(b,{direction:"row",gap:"size-100",justifyContent:"end",width:"100%",children:e(EK,{promptVersionTagId:d.original.id,promptId:d.original.promptId},d.original.id)})}],[]),t=m.useMemo(()=>a.versionTags.map(d=>({id:d.id,name:d.name,description:d.description,promptId:a.id,promptVersionId:d.promptVersionId})),[a]),i=Ke({columns:l,data:t,getCoreRowModel:Te(),getSortedRowModel:ln()}),r=i.getRowModel().rows,s=r.length===0;return e(B,{title:"Tags",variant:"compact",bodyStyle:{padding:0},children:o("table",{css:He,children:[e("thead",{children:i.getHeaderGroups().map(d=>e("tr",{children:d.headers.map(c=>e("th",{colSpan:c.colSpan,children:c.isPlaceholder?null:o("div",{className:c.column.getCanSort()?"cursor-pointer":"",onClick:c.column.getToggleSortingHandler(),style:{left:c.getStart(),width:c.getSize()},children:[W(c.column.columnDef.header,c.getContext()),c.column.getIsSorted()?e(_,{className:"sort-icon",svg:c.column.getIsSorted()==="asc"?e(We,{}):e(Je,{})}):null]})},c.id))},d.id))}),s?e(tn,{message:"No Tags"}):e("tbody",{children:r.map(d=>e("tr",{children:d.getVisibleCells().map(c=>e("td",{children:W(c.column.columnDef.cell,c.getContext())},c.id))},d.id))})]})})}function mP(){const n=Me();return je(n),e(b,{direction:"row",height:"100%",children:e(v,{height:"100%",overflow:"auto",width:"100%","data-testid":"scroll-container",children:e(v,{padding:"size-200",children:e(b,{direction:"column",gap:"size-200",marginStart:"auto",marginEnd:"auto",maxWidth:900,children:e(MK,{prompt:n.prompt})})})})})}function gP(){const n=Me();return je(n),e(yh,{query:n,children:e(Ce,{})})}const rp=function(){var n={alias:null,args:null,kind:"ScalarField",name:"passwordNeedsReset",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"authenticatedRootLoaderQuery",selections:[{args:null,kind:"FragmentSpread",name:"ViewerContext_viewer"},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"viewer",plural:!1,selections:[n],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"authenticatedRootLoaderQuery",selections:[{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"viewer",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},{alias:null,args:null,concreteType:"UserRole",kind:"LinkedField",name:"role",plural:!1,selections:[l,a],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"authMethod",storageKey:null},{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"apiKeys",plural:!0,selections:[a,l,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null},n],storageKey:null}]},params:{cacheID:"9a44f89c9ef9c0c136d78242e89b66e3",id:null,metadata:{},name:"authenticatedRootLoaderQuery",operationKind:"query",text:`query authenticatedRootLoaderQuery {
|
|
7366
7366
|
...ViewerContext_viewer
|
|
7367
7367
|
viewer {
|
|
7368
7368
|
passwordNeedsReset
|