arize-phoenix 4.12.1rc1__py3-none-any.whl → 4.15.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of arize-phoenix might be problematic. Click here for more details.
- {arize_phoenix-4.12.1rc1.dist-info → arize_phoenix-4.15.0.dist-info}/METADATA +10 -6
- {arize_phoenix-4.12.1rc1.dist-info → arize_phoenix-4.15.0.dist-info}/RECORD +70 -68
- phoenix/db/bulk_inserter.py +5 -4
- phoenix/db/engines.py +2 -1
- phoenix/experiments/evaluators/base.py +4 -0
- phoenix/experiments/evaluators/code_evaluators.py +80 -0
- phoenix/experiments/evaluators/llm_evaluators.py +77 -1
- phoenix/experiments/evaluators/utils.py +70 -21
- phoenix/experiments/functions.py +17 -16
- phoenix/server/api/context.py +5 -3
- phoenix/server/api/dataloaders/__init__.py +2 -0
- phoenix/server/api/dataloaders/average_experiment_run_latency.py +25 -25
- phoenix/server/api/dataloaders/dataset_example_revisions.py +2 -4
- phoenix/server/api/dataloaders/dataset_example_spans.py +2 -4
- phoenix/server/api/dataloaders/document_evaluation_summaries.py +2 -4
- phoenix/server/api/dataloaders/document_evaluations.py +2 -4
- phoenix/server/api/dataloaders/document_retrieval_metrics.py +2 -4
- phoenix/server/api/dataloaders/evaluation_summaries.py +2 -4
- phoenix/server/api/dataloaders/experiment_annotation_summaries.py +2 -4
- phoenix/server/api/dataloaders/experiment_error_rates.py +32 -14
- phoenix/server/api/dataloaders/experiment_run_counts.py +20 -9
- phoenix/server/api/dataloaders/experiment_sequence_number.py +2 -4
- phoenix/server/api/dataloaders/latency_ms_quantile.py +2 -3
- phoenix/server/api/dataloaders/min_start_or_max_end_times.py +2 -4
- phoenix/server/api/dataloaders/project_by_name.py +3 -3
- phoenix/server/api/dataloaders/record_counts.py +2 -4
- phoenix/server/api/dataloaders/span_annotations.py +2 -4
- phoenix/server/api/dataloaders/span_dataset_examples.py +36 -0
- phoenix/server/api/dataloaders/span_descendants.py +2 -4
- phoenix/server/api/dataloaders/span_evaluations.py +2 -4
- phoenix/server/api/dataloaders/span_projects.py +3 -3
- phoenix/server/api/dataloaders/token_counts.py +2 -4
- phoenix/server/api/dataloaders/trace_evaluations.py +2 -4
- phoenix/server/api/dataloaders/trace_row_ids.py +2 -4
- phoenix/server/api/input_types/{CreateSpanAnnotationsInput.py → CreateSpanAnnotationInput.py} +4 -2
- phoenix/server/api/input_types/{CreateTraceAnnotationsInput.py → CreateTraceAnnotationInput.py} +4 -2
- phoenix/server/api/input_types/{PatchAnnotationsInput.py → PatchAnnotationInput.py} +4 -2
- phoenix/server/api/mutations/span_annotations_mutations.py +20 -9
- phoenix/server/api/mutations/trace_annotations_mutations.py +20 -9
- phoenix/server/api/routers/v1/datasets.py +132 -10
- phoenix/server/api/routers/v1/evaluations.py +3 -5
- phoenix/server/api/routers/v1/experiments.py +1 -1
- phoenix/server/api/types/Experiment.py +2 -2
- phoenix/server/api/types/Inferences.py +1 -2
- phoenix/server/api/types/Model.py +1 -2
- phoenix/server/api/types/Span.py +5 -0
- phoenix/server/api/utils.py +4 -4
- phoenix/server/app.py +21 -18
- phoenix/server/grpc_server.py +2 -2
- phoenix/server/main.py +5 -9
- phoenix/server/static/.vite/manifest.json +31 -31
- phoenix/server/static/assets/{components-C8sm_r1F.js → components-kGgeFkHp.js} +150 -110
- phoenix/server/static/assets/index-BctFO6S7.js +100 -0
- phoenix/server/static/assets/{pages-bN7juCjh.js → pages-DabDCmVd.js} +432 -255
- phoenix/server/static/assets/{vendor-CUDAPm8e.js → vendor-CP0b0YG0.js} +2 -2
- phoenix/server/static/assets/{vendor-arizeai-Do2HOmcL.js → vendor-arizeai-B5Hti8OB.js} +27 -27
- phoenix/server/static/assets/vendor-codemirror-DtdPDzrv.js +15 -0
- phoenix/server/static/assets/{vendor-recharts-PKRvByVe.js → vendor-recharts-A0DA1O99.js} +1 -1
- phoenix/server/types.py +18 -0
- phoenix/session/client.py +9 -6
- phoenix/session/session.py +2 -2
- phoenix/trace/dsl/filter.py +40 -25
- phoenix/trace/fixtures.py +17 -23
- phoenix/trace/utils.py +23 -0
- phoenix/utilities/client.py +116 -0
- phoenix/utilities/project.py +1 -1
- phoenix/version.py +1 -1
- phoenix/server/api/routers/v1/dataset_examples.py +0 -157
- phoenix/server/static/assets/index-BEKPzgQs.js +0 -100
- phoenix/server/static/assets/vendor-codemirror-CrdxOlMs.js +0 -12
- {arize_phoenix-4.12.1rc1.dist-info → arize_phoenix-4.15.0.dist-info}/WHEEL +0 -0
- {arize_phoenix-4.12.1rc1.dist-info → arize_phoenix-4.15.0.dist-info}/licenses/IP_NOTICE +0 -0
- {arize_phoenix-4.12.1rc1.dist-info → arize_phoenix-4.15.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c1 as Wr,c2 as gu,c3 as zt,c4 as ye,c5 as Wt,r as B,c6 as W,c7 as z,c8 as da,c9 as X,R as A,ca as Dn,cb as bu,cc as Kc,cd as xu,ce as Ou,cf as Au,cg as wu,ch as Pu,ci as Su,cj as Ti,ck as fi,cl as Fc,cm as Z,cn as at,co as ki,cp as Ii,cq as rn,cr as _i,cs as Mn,ct as Re,cu as ju,cv as Eu,cw as $u,cx as Fe,cy as Tu,cz as ku,cA as Iu,cB as _u,cC as Cu,cD as Hr,cE as Du,cF as Vc,cG as Mu,cH as Bu,cI as Nu,cJ as Lu,cK as Ru,cL as zu,cM as Wu,cN as Ku,cO as Fu,cP as Vu,cQ as Xu,cR as Gu,cS as Me,cT as Hu,cU as Uu,cV as Yu,cW as qu,cX as an,cY as Zu,cZ as Xc,c_ as Ju,c$ as Qu,d0 as es,d1 as ts}from"./vendor-CUDAPm8e.js";var se=function(e){return e===0?0:e>0?1:-1},tt=function(e){return Wr(e)&&e.indexOf("%")===e.length-1},M=function(e){return gu(e)&&!zt(e)},ne=function(e){return M(e)||Wr(e)},rs=0,Xe=function(e){var r=++rs;return"".concat(e||"").concat(r)},fe=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!M(e)&&!Wr(e))return n;var i;if(tt(e)){var o=e.indexOf("%");i=r*parseFloat(e.slice(0,o))/100}else i=+e;return zt(i)&&(i=n),a&&i>r&&(i=r),i},Le=function(e){if(!e)return null;var r=Object.keys(e);return r&&r.length?e[r[0]]:null},ns=function(e){if(!Array.isArray(e))return!1;for(var r=e.length,n={},a=0;a<r;a++)if(!n[e[a]])n[e[a]]=!0;else return!0;return!1},te=function(e,r){return M(e)&&M(r)?function(n){return e+n*(r-e)}:function(){return r}};function on(t,e,r){return!t||!t.length?null:t.find(function(n){return n&&(typeof e=="function"?e(n):ye(n,e))===r})}var as=function(e){if(!e||!e.length)return null;for(var r=e.length,n=0,a=0,i=0,o=0,c=1/0,l=-1/0,u=0,s=0,f=0;f<r;f++)u=e[f].cx||0,s=e[f].cy||0,n+=u,a+=s,i+=u*s,o+=u*u,c=Math.min(c,u),l=Math.max(l,u);var d=r*o!==n*n?(r*i-n*a)/(r*o-n*n):0;return{xmin:c,xmax:l,a:d,b:(a-d*n)/r}};function Ot(t,e){for(var r in t)if({}.hasOwnProperty.call(t,r)&&(!{}.hasOwnProperty.call(e,r)||t[r]!==e[r]))return!1;for(var n in e)if({}.hasOwnProperty.call(e,n)&&!{}.hasOwnProperty.call(t,n))return!1;return!0}function pa(t){"@babel/helpers - typeof";return pa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pa(t)}var is=["viewBox","children"],os=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],Ci=["points","pathLength"],ta={svg:is,polygon:Ci,polyline:Ci},di=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],cn=function(e,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(B.isValidElement(e)&&(n=e.props),!Wt(n))return null;var a={};return Object.keys(n).forEach(function(i){di.includes(i)&&(a[i]=r||function(o){return n[i](n,o)})}),a},cs=function(e,r,n){return function(a){return e(r,n,a),null}},Ve=function(e,r,n){if(!Wt(e)||pa(e)!=="object")return null;var a=null;return Object.keys(e).forEach(function(i){var o=e[i];di.includes(i)&&typeof o=="function"&&(a||(a={}),a[i]=cs(o,r,n))}),a},ls=["children"],us=["children"];function Di(t,e){if(t==null)return{};var r=ss(t,e),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)n=i[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function ss(t,e){if(t==null)return{};var r={},n=Object.keys(t),a,i;for(i=0;i<n.length;i++)a=n[i],!(e.indexOf(a)>=0)&&(r[a]=t[a]);return r}function va(t){"@babel/helpers - typeof";return va=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},va(t)}var Mi={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"},De=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},Bi=null,ra=null,pi=function t(e){if(e===Bi&&Array.isArray(ra))return ra;var r=[];return B.Children.forEach(e,function(n){z(n)||(da.isFragment(n)?r=r.concat(t(n.props.children)):r.push(n))}),ra=r,Bi=e,r};function de(t,e){var r=[],n=[];return Array.isArray(e)?n=e.map(function(a){return De(a)}):n=[De(e)],pi(t).forEach(function(a){var i=ye(a,"type.displayName")||ye(a,"type.name");n.indexOf(i)!==-1&&r.push(a)}),r}function he(t,e){var r=de(t,e);return r&&r[0]}var Ni=function(e){if(!e||!e.props)return!1;var r=e.props,n=r.width,a=r.height;return!(!M(n)||n<=0||!M(a)||a<=0)},fs=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],ds=function(e){return e&&e.type&&Wr(e.type)&&fs.indexOf(e.type)>=0},Gc=function(e){return e&&va(e)==="object"&&"cx"in e&&"cy"in e&&"r"in e},ps=function(e,r,n,a){var i,o=(i=ta==null?void 0:ta[a])!==null&&i!==void 0?i:[];return!W(e)&&(a&&o.includes(r)||os.includes(r))||n&&di.includes(r)},R=function(e,r,n){if(!e||typeof e=="function"||typeof e=="boolean")return null;var a=e;if(B.isValidElement(e)&&(a=e.props),!Wt(a))return null;var i={};return Object.keys(a).forEach(function(o){var c;ps((c=a)===null||c===void 0?void 0:c[o],o,r,n)&&(i[o]=a[o])}),i},ha=function t(e,r){if(e===r)return!0;var n=B.Children.count(e);if(n!==B.Children.count(r))return!1;if(n===0)return!0;if(n===1)return Li(Array.isArray(e)?e[0]:e,Array.isArray(r)?r[0]:r);for(var a=0;a<n;a++){var i=e[a],o=r[a];if(Array.isArray(i)||Array.isArray(o)){if(!t(i,o))return!1}else if(!Li(i,o))return!1}return!0},Li=function(e,r){if(z(e)&&z(r))return!0;if(!z(e)&&!z(r)){var n=e.props||{},a=n.children,i=Di(n,ls),o=r.props||{},c=o.children,l=Di(o,us);return a&&c?Ot(i,l)&&ha(a,c):!a&&!c?Ot(i,l):!1}return!1},Ri=function(e,r){var n=[],a={};return pi(e).forEach(function(i,o){if(ds(i))n.push(i);else if(i){var c=De(i.type),l=r[c]||{},u=l.handler,s=l.once;if(u&&(!s||!a[c])){var f=u(i,c,o);n.push(f),a[c]=!0}}}),n},vs=function(e){var r=e&&e.type;return r&&Mi[r]?Mi[r]:null},hs=function(e,r){return pi(r).indexOf(e)},ys=["children","width","height","viewBox","className","style","title","desc"];function ya(){return ya=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ya.apply(this,arguments)}function ms(t,e){if(t==null)return{};var r=gs(t,e),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)n=i[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function gs(t,e){if(t==null)return{};var r={},n=Object.keys(t),a,i;for(i=0;i<n.length;i++)a=n[i],!(e.indexOf(a)>=0)&&(r[a]=t[a]);return r}function ma(t){var e=t.children,r=t.width,n=t.height,a=t.viewBox,i=t.className,o=t.style,c=t.title,l=t.desc,u=ms(t,ys),s=a||{width:r,height:n,x:0,y:0},f=X("recharts-surface",i);return A.createElement("svg",ya({},R(u,!0,"svg"),{className:f,width:r,height:n,style:o,viewBox:"".concat(s.x," ").concat(s.y," ").concat(s.width," ").concat(s.height)}),A.createElement("title",null,c),A.createElement("desc",null,l),e)}var bs=["children","className"];function ga(){return ga=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ga.apply(this,arguments)}function xs(t,e){if(t==null)return{};var r=Os(t,e),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)n=i[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Os(t,e){if(t==null)return{};var r={},n=Object.keys(t),a,i;for(i=0;i<n.length;i++)a=n[i],!(e.indexOf(a)>=0)&&(r[a]=t[a]);return r}var H=A.forwardRef(function(t,e){var r=t.children,n=t.className,a=xs(t,bs),i=X("recharts-layer",n);return A.createElement("g",ga({className:i},R(a,!0),{ref:e}),r)}),je=function(e,r){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i]};function sr(t){"@babel/helpers - typeof";return sr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sr(t)}var As=["type","size","sizeType"];function ba(){return ba=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ba.apply(this,arguments)}function zi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Wi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?zi(Object(r),!0).forEach(function(n){ws(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zi(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ws(t,e,r){return e=Ps(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ps(t){var e=Ss(t,"string");return sr(e)=="symbol"?e:String(e)}function Ss(t,e){if(sr(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(sr(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function js(t,e){if(t==null)return{};var r=Es(t,e),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)n=i[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Es(t,e){if(t==null)return{};var r={},n=Object.keys(t),a,i;for(i=0;i<n.length;i++)a=n[i],!(e.indexOf(a)>=0)&&(r[a]=t[a]);return r}var Hc={symbolCircle:Kc,symbolCross:xu,symbolDiamond:Ou,symbolSquare:Au,symbolStar:wu,symbolTriangle:Pu,symbolWye:Su},$s=Math.PI/180,Ts=function(e){var r="symbol".concat(Dn(e));return Hc[r]||Kc},ks=function(e,r,n){if(r==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var a=18*$s;return 1.25*e*e*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Is=function(e,r){Hc["symbol".concat(Dn(e))]=r},Bn=function(e){var r=e.type,n=r===void 0?"circle":r,a=e.size,i=a===void 0?64:a,o=e.sizeType,c=o===void 0?"area":o,l=js(e,As),u=Wi(Wi({},l),{},{type:n,size:i,sizeType:c}),s=function(){var g=Ts(n),O=bu().type(g).size(ks(i,c,n));return O()},f=u.className,d=u.cx,p=u.cy,m=R(u,!0);return d===+d&&p===+p&&i===+i?A.createElement("path",ba({},m,{className:X("recharts-symbols",f),transform:"translate(".concat(d,", ").concat(p,")"),d:s()})):null};Bn.registerSymbol=Is;function wt(t){"@babel/helpers - typeof";return wt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wt(t)}function xa(){return xa=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},xa.apply(this,arguments)}function Ki(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function _s(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ki(Object(r),!0).forEach(function(n){fr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ki(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Cs(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ds(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Yc(n.key),n)}}function Ms(t,e,r){return e&&Ds(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Bs(t,e,r){return e=ln(e),Ns(t,Uc()?Reflect.construct(e,r||[],ln(t).constructor):e.apply(t,r))}function Ns(t,e){if(e&&(wt(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ls(t)}function Ls(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Uc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Uc=function(){return!!t})()}function ln(t){return ln=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ln(t)}function Rs(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Oa(t,e)}function Oa(t,e){return Oa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Oa(t,e)}function fr(t,e,r){return e=Yc(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yc(t){var e=zs(t,"string");return wt(e)=="symbol"?e:String(e)}function zs(t,e){if(wt(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(wt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var be=32,vi=function(t){Rs(e,t);function e(){return Cs(this,e),Bs(this,e,arguments)}return Ms(e,[{key:"renderIcon",value:function(n){var a=this.props.inactiveColor,i=be/2,o=be/6,c=be/3,l=n.inactive?a:n.color;if(n.type==="plainline")return A.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:i,x2:be,y2:i,className:"recharts-legend-icon"});if(n.type==="line")return A.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(i,"h").concat(c,`
|
|
1
|
+
import{c2 as Wr,c3 as gu,c4 as zt,c5 as ye,c6 as Wt,r as B,c7 as W,c8 as z,c9 as da,ca as X,R as A,cb as Dn,cc as bu,cd as Kc,ce as xu,cf as Ou,cg as Au,ch as wu,ci as Pu,cj as Su,ck as Ti,cl as fi,cm as Fc,cn as Z,co as at,cp as ki,cq as Ii,cr as rn,cs as _i,ct as Mn,cu as Re,cv as ju,cw as Eu,cx as $u,cy as Fe,cz as Tu,cA as ku,cB as Iu,cC as _u,cD as Cu,cE as Hr,cF as Du,cG as Vc,cH as Mu,cI as Bu,cJ as Nu,cK as Lu,cL as Ru,cM as zu,cN as Wu,cO as Ku,cP as Fu,cQ as Vu,cR as Xu,cS as Gu,cT as Me,cU as Hu,cV as Uu,cW as Yu,cX as qu,cY as an,cZ as Zu,c_ as Xc,c$ as Ju,d0 as Qu,d1 as es,d2 as ts}from"./vendor-CP0b0YG0.js";var se=function(e){return e===0?0:e>0?1:-1},tt=function(e){return Wr(e)&&e.indexOf("%")===e.length-1},M=function(e){return gu(e)&&!zt(e)},ne=function(e){return M(e)||Wr(e)},rs=0,Xe=function(e){var r=++rs;return"".concat(e||"").concat(r)},fe=function(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!M(e)&&!Wr(e))return n;var i;if(tt(e)){var o=e.indexOf("%");i=r*parseFloat(e.slice(0,o))/100}else i=+e;return zt(i)&&(i=n),a&&i>r&&(i=r),i},Le=function(e){if(!e)return null;var r=Object.keys(e);return r&&r.length?e[r[0]]:null},ns=function(e){if(!Array.isArray(e))return!1;for(var r=e.length,n={},a=0;a<r;a++)if(!n[e[a]])n[e[a]]=!0;else return!0;return!1},te=function(e,r){return M(e)&&M(r)?function(n){return e+n*(r-e)}:function(){return r}};function on(t,e,r){return!t||!t.length?null:t.find(function(n){return n&&(typeof e=="function"?e(n):ye(n,e))===r})}var as=function(e){if(!e||!e.length)return null;for(var r=e.length,n=0,a=0,i=0,o=0,c=1/0,l=-1/0,u=0,s=0,f=0;f<r;f++)u=e[f].cx||0,s=e[f].cy||0,n+=u,a+=s,i+=u*s,o+=u*u,c=Math.min(c,u),l=Math.max(l,u);var d=r*o!==n*n?(r*i-n*a)/(r*o-n*n):0;return{xmin:c,xmax:l,a:d,b:(a-d*n)/r}};function Ot(t,e){for(var r in t)if({}.hasOwnProperty.call(t,r)&&(!{}.hasOwnProperty.call(e,r)||t[r]!==e[r]))return!1;for(var n in e)if({}.hasOwnProperty.call(e,n)&&!{}.hasOwnProperty.call(t,n))return!1;return!0}function pa(t){"@babel/helpers - typeof";return pa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pa(t)}var is=["viewBox","children"],os=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],Ci=["points","pathLength"],ta={svg:is,polygon:Ci,polyline:Ci},di=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],cn=function(e,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var n=e;if(B.isValidElement(e)&&(n=e.props),!Wt(n))return null;var a={};return Object.keys(n).forEach(function(i){di.includes(i)&&(a[i]=r||function(o){return n[i](n,o)})}),a},cs=function(e,r,n){return function(a){return e(r,n,a),null}},Ve=function(e,r,n){if(!Wt(e)||pa(e)!=="object")return null;var a=null;return Object.keys(e).forEach(function(i){var o=e[i];di.includes(i)&&typeof o=="function"&&(a||(a={}),a[i]=cs(o,r,n))}),a},ls=["children"],us=["children"];function Di(t,e){if(t==null)return{};var r=ss(t,e),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)n=i[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function ss(t,e){if(t==null)return{};var r={},n=Object.keys(t),a,i;for(i=0;i<n.length;i++)a=n[i],!(e.indexOf(a)>=0)&&(r[a]=t[a]);return r}function va(t){"@babel/helpers - typeof";return va=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},va(t)}var Mi={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"},De=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},Bi=null,ra=null,pi=function t(e){if(e===Bi&&Array.isArray(ra))return ra;var r=[];return B.Children.forEach(e,function(n){z(n)||(da.isFragment(n)?r=r.concat(t(n.props.children)):r.push(n))}),ra=r,Bi=e,r};function de(t,e){var r=[],n=[];return Array.isArray(e)?n=e.map(function(a){return De(a)}):n=[De(e)],pi(t).forEach(function(a){var i=ye(a,"type.displayName")||ye(a,"type.name");n.indexOf(i)!==-1&&r.push(a)}),r}function he(t,e){var r=de(t,e);return r&&r[0]}var Ni=function(e){if(!e||!e.props)return!1;var r=e.props,n=r.width,a=r.height;return!(!M(n)||n<=0||!M(a)||a<=0)},fs=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],ds=function(e){return e&&e.type&&Wr(e.type)&&fs.indexOf(e.type)>=0},Gc=function(e){return e&&va(e)==="object"&&"cx"in e&&"cy"in e&&"r"in e},ps=function(e,r,n,a){var i,o=(i=ta==null?void 0:ta[a])!==null&&i!==void 0?i:[];return!W(e)&&(a&&o.includes(r)||os.includes(r))||n&&di.includes(r)},R=function(e,r,n){if(!e||typeof e=="function"||typeof e=="boolean")return null;var a=e;if(B.isValidElement(e)&&(a=e.props),!Wt(a))return null;var i={};return Object.keys(a).forEach(function(o){var c;ps((c=a)===null||c===void 0?void 0:c[o],o,r,n)&&(i[o]=a[o])}),i},ha=function t(e,r){if(e===r)return!0;var n=B.Children.count(e);if(n!==B.Children.count(r))return!1;if(n===0)return!0;if(n===1)return Li(Array.isArray(e)?e[0]:e,Array.isArray(r)?r[0]:r);for(var a=0;a<n;a++){var i=e[a],o=r[a];if(Array.isArray(i)||Array.isArray(o)){if(!t(i,o))return!1}else if(!Li(i,o))return!1}return!0},Li=function(e,r){if(z(e)&&z(r))return!0;if(!z(e)&&!z(r)){var n=e.props||{},a=n.children,i=Di(n,ls),o=r.props||{},c=o.children,l=Di(o,us);return a&&c?Ot(i,l)&&ha(a,c):!a&&!c?Ot(i,l):!1}return!1},Ri=function(e,r){var n=[],a={};return pi(e).forEach(function(i,o){if(ds(i))n.push(i);else if(i){var c=De(i.type),l=r[c]||{},u=l.handler,s=l.once;if(u&&(!s||!a[c])){var f=u(i,c,o);n.push(f),a[c]=!0}}}),n},vs=function(e){var r=e&&e.type;return r&&Mi[r]?Mi[r]:null},hs=function(e,r){return pi(r).indexOf(e)},ys=["children","width","height","viewBox","className","style","title","desc"];function ya(){return ya=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ya.apply(this,arguments)}function ms(t,e){if(t==null)return{};var r=gs(t,e),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)n=i[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function gs(t,e){if(t==null)return{};var r={},n=Object.keys(t),a,i;for(i=0;i<n.length;i++)a=n[i],!(e.indexOf(a)>=0)&&(r[a]=t[a]);return r}function ma(t){var e=t.children,r=t.width,n=t.height,a=t.viewBox,i=t.className,o=t.style,c=t.title,l=t.desc,u=ms(t,ys),s=a||{width:r,height:n,x:0,y:0},f=X("recharts-surface",i);return A.createElement("svg",ya({},R(u,!0,"svg"),{className:f,width:r,height:n,style:o,viewBox:"".concat(s.x," ").concat(s.y," ").concat(s.width," ").concat(s.height)}),A.createElement("title",null,c),A.createElement("desc",null,l),e)}var bs=["children","className"];function ga(){return ga=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ga.apply(this,arguments)}function xs(t,e){if(t==null)return{};var r=Os(t,e),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)n=i[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Os(t,e){if(t==null)return{};var r={},n=Object.keys(t),a,i;for(i=0;i<n.length;i++)a=n[i],!(e.indexOf(a)>=0)&&(r[a]=t[a]);return r}var H=A.forwardRef(function(t,e){var r=t.children,n=t.className,a=xs(t,bs),i=X("recharts-layer",n);return A.createElement("g",ga({className:i},R(a,!0),{ref:e}),r)}),je=function(e,r){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i]};function sr(t){"@babel/helpers - typeof";return sr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sr(t)}var As=["type","size","sizeType"];function ba(){return ba=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ba.apply(this,arguments)}function zi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Wi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?zi(Object(r),!0).forEach(function(n){ws(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zi(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ws(t,e,r){return e=Ps(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ps(t){var e=Ss(t,"string");return sr(e)=="symbol"?e:String(e)}function Ss(t,e){if(sr(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(sr(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function js(t,e){if(t==null)return{};var r=Es(t,e),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)n=i[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Es(t,e){if(t==null)return{};var r={},n=Object.keys(t),a,i;for(i=0;i<n.length;i++)a=n[i],!(e.indexOf(a)>=0)&&(r[a]=t[a]);return r}var Hc={symbolCircle:Kc,symbolCross:xu,symbolDiamond:Ou,symbolSquare:Au,symbolStar:wu,symbolTriangle:Pu,symbolWye:Su},$s=Math.PI/180,Ts=function(e){var r="symbol".concat(Dn(e));return Hc[r]||Kc},ks=function(e,r,n){if(r==="area")return e;switch(n){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var a=18*$s;return 1.25*e*e*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Is=function(e,r){Hc["symbol".concat(Dn(e))]=r},Bn=function(e){var r=e.type,n=r===void 0?"circle":r,a=e.size,i=a===void 0?64:a,o=e.sizeType,c=o===void 0?"area":o,l=js(e,As),u=Wi(Wi({},l),{},{type:n,size:i,sizeType:c}),s=function(){var g=Ts(n),O=bu().type(g).size(ks(i,c,n));return O()},f=u.className,d=u.cx,p=u.cy,m=R(u,!0);return d===+d&&p===+p&&i===+i?A.createElement("path",ba({},m,{className:X("recharts-symbols",f),transform:"translate(".concat(d,", ").concat(p,")"),d:s()})):null};Bn.registerSymbol=Is;function wt(t){"@babel/helpers - typeof";return wt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wt(t)}function xa(){return xa=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},xa.apply(this,arguments)}function Ki(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function _s(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ki(Object(r),!0).forEach(function(n){fr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ki(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Cs(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ds(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Yc(n.key),n)}}function Ms(t,e,r){return e&&Ds(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Bs(t,e,r){return e=ln(e),Ns(t,Uc()?Reflect.construct(e,r||[],ln(t).constructor):e.apply(t,r))}function Ns(t,e){if(e&&(wt(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ls(t)}function Ls(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Uc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Uc=function(){return!!t})()}function ln(t){return ln=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ln(t)}function Rs(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Oa(t,e)}function Oa(t,e){return Oa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Oa(t,e)}function fr(t,e,r){return e=Yc(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yc(t){var e=zs(t,"string");return wt(e)=="symbol"?e:String(e)}function zs(t,e){if(wt(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(wt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var be=32,vi=function(t){Rs(e,t);function e(){return Cs(this,e),Bs(this,e,arguments)}return Ms(e,[{key:"renderIcon",value:function(n){var a=this.props.inactiveColor,i=be/2,o=be/6,c=be/3,l=n.inactive?a:n.color;if(n.type==="plainline")return A.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:n.payload.strokeDasharray,x1:0,y1:i,x2:be,y2:i,className:"recharts-legend-icon"});if(n.type==="line")return A.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(i,"h").concat(c,`
|
|
2
2
|
A`).concat(o,",").concat(o,",0,1,1,").concat(2*c,",").concat(i,`
|
|
3
3
|
H`).concat(be,"M").concat(2*c,",").concat(i,`
|
|
4
4
|
A`).concat(o,",").concat(o,",0,1,1,").concat(c,",").concat(i),className:"recharts-legend-icon"});if(n.type==="rect")return A.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(be/8,"h").concat(be,"v").concat(be*3/4,"h").concat(-be,"z"),className:"recharts-legend-icon"});if(A.isValidElement(n.legendIcon)){var u=_s({},n);return delete u.legendIcon,A.cloneElement(n.legendIcon,u)}return A.createElement(Bn,{fill:l,cx:i,cy:i,size:be,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,a=this.props,i=a.payload,o=a.iconSize,c=a.layout,l=a.formatter,u=a.inactiveColor,s={x:0,y:0,width:be,height:be},f={display:c==="horizontal"?"inline-block":"block",marginRight:10},d={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(p,m){var y=p.formatter||l,g=X(fr(fr({"recharts-legend-item":!0},"legend-item-".concat(m),!0),"inactive",p.inactive));if(p.type==="none")return null;var O=W(p.value)?null:p.value;je(!W(p.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var b=p.inactive?u:p.color;return A.createElement("li",xa({className:g,style:f,key:"legend-item-".concat(m)},Ve(n.props,p,m)),A.createElement(ma,{width:o,height:o,viewBox:s,style:d},n.renderIcon(p)),A.createElement("span",{className:"recharts-legend-item-text",style:{color:b}},y?y(O,p,m):O))})}},{key:"render",value:function(){var n=this.props,a=n.payload,i=n.layout,o=n.align;if(!a||!a.length)return null;var c={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return A.createElement("ul",{className:"recharts-default-legend",style:c},this.renderItems())}}]),e}(B.PureComponent);fr(vi,"displayName","Legend");fr(vi,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});function qc(t,e,r){return e===!0?Ti(t,r):W(e)?Ti(t,e):t}function Pt(t){"@babel/helpers - typeof";return Pt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pt(t)}var Ws=["ref"];function Fi(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Ze(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Fi(Object(r),!0).forEach(function(n){Nn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Fi(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ks(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Vi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Qc(n.key),n)}}function Fs(t,e,r){return e&&Vi(t.prototype,e),r&&Vi(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Vs(t,e,r){return e=un(e),Xs(t,Zc()?Reflect.construct(e,r||[],un(t).constructor):e.apply(t,r))}function Xs(t,e){if(e&&(Pt(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Jc(t)}function Zc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Zc=function(){return!!t})()}function un(t){return un=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},un(t)}function Jc(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Gs(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Aa(t,e)}function Aa(t,e){return Aa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,a){return n.__proto__=a,n},Aa(t,e)}function Nn(t,e,r){return e=Qc(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Qc(t){var e=Hs(t,"string");return Pt(e)=="symbol"?e:String(e)}function Hs(t,e){if(Pt(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Pt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Us(t,e){if(t==null)return{};var r=Ys(t,e),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)n=i[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Ys(t,e){if(t==null)return{};var r={},n=Object.keys(t),a,i;for(i=0;i<n.length;i++)a=n[i],!(e.indexOf(a)>=0)&&(r[a]=t[a]);return r}function qs(t){return t.value}function Zs(t,e){if(A.isValidElement(t))return A.cloneElement(t,e);if(typeof t=="function")return A.createElement(t,e);e.ref;var r=Us(e,Ws);return A.createElement(vi,r)}var Xi=1,dr=function(t){Gs(e,t);function e(){var r;Ks(this,e);for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return r=Vs(this,e,[].concat(a)),Nn(Jc(r),"lastBoundingBox",{width:-1,height:-1}),r}return Fs(e,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var n=this.wrapperNode.getBoundingClientRect();return n.height=this.wrapperNode.offsetHeight,n.width=this.wrapperNode.offsetWidth,n}return null}},{key:"updateBBox",value:function(){var n=this.props.onBBoxUpdate,a=this.getBBox();a?(Math.abs(a.width-this.lastBoundingBox.width)>Xi||Math.abs(a.height-this.lastBoundingBox.height)>Xi)&&(this.lastBoundingBox.width=a.width,this.lastBoundingBox.height=a.height,n&&n(a)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Ze({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var a=this.props,i=a.layout,o=a.align,c=a.verticalAlign,l=a.margin,u=a.chartWidth,s=a.chartHeight,f,d;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&i==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=o==="right"?{right:l&&l.right||0}:{left:l&&l.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(c==="middle"){var m=this.getBBoxSnapshot();d={top:((s||0)-m.height)/2}}else d=c==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return Ze(Ze({},f),d)}},{key:"render",value:function(){var n=this,a=this.props,i=a.content,o=a.width,c=a.height,l=a.wrapperStyle,u=a.payloadUniqBy,s=a.payload,f=Ze(Ze({position:"absolute",width:o||"auto",height:c||"auto"},this.getDefaultPosition(l)),l);return A.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){n.wrapperNode=p}},Zs(i,Ze(Ze({},this.props),{},{payload:qc(s,u,qs)})))}}],[{key:"getWithHeight",value:function(n,a){var i=n.props.layout;return i==="vertical"&&M(n.props.height)?{height:n.props.height}:i==="horizontal"?{width:n.props.width||a}:null}}]),e}(B.PureComponent);Nn(dr,"displayName","Legend");Nn(dr,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});function pr(t){"@babel/helpers - typeof";return pr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pr(t)}function wa(){return wa=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},wa.apply(this,arguments)}function Js(t,e){return rf(t)||tf(t,e)||ef(t,e)||Qs()}function Qs(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
phoenix/server/types.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from typing import AsyncContextManager, Callable
|
|
2
|
+
|
|
3
|
+
from sqlalchemy.ext.asyncio import AsyncSession
|
|
4
|
+
|
|
5
|
+
from phoenix.db.helpers import SupportedSQLDialect
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class DbSessionFactory:
|
|
9
|
+
def __init__(
|
|
10
|
+
self,
|
|
11
|
+
db: Callable[[], AsyncContextManager[AsyncSession]],
|
|
12
|
+
dialect: str,
|
|
13
|
+
):
|
|
14
|
+
self._db = db
|
|
15
|
+
self.dialect = SupportedSQLDialect(dialect)
|
|
16
|
+
|
|
17
|
+
def __call__(self) -> AsyncContextManager[AsyncSession]:
|
|
18
|
+
return self._db()
|
phoenix/session/client.py
CHANGED
|
@@ -22,6 +22,7 @@ from typing import (
|
|
|
22
22
|
cast,
|
|
23
23
|
)
|
|
24
24
|
from urllib.parse import quote, urljoin
|
|
25
|
+
from warnings import warn
|
|
25
26
|
|
|
26
27
|
import httpx
|
|
27
28
|
import pandas as pd
|
|
@@ -48,6 +49,7 @@ from phoenix.session.data_extractor import DEFAULT_SPAN_LIMIT, TraceDataExtracto
|
|
|
48
49
|
from phoenix.trace import Evaluations, TraceDataset
|
|
49
50
|
from phoenix.trace.dsl import SpanQuery
|
|
50
51
|
from phoenix.trace.otel import encode_span_to_otlp
|
|
52
|
+
from phoenix.utilities.client import VersionedClient
|
|
51
53
|
|
|
52
54
|
logger = logging.getLogger(__name__)
|
|
53
55
|
|
|
@@ -91,7 +93,7 @@ class Client(TraceDataExtractor):
|
|
|
91
93
|
host = "127.0.0.1"
|
|
92
94
|
base_url = endpoint or get_env_collector_endpoint() or f"http://{host}:{get_env_port()}"
|
|
93
95
|
self._base_url = base_url if base_url.endswith("/") else base_url + "/"
|
|
94
|
-
self._client =
|
|
96
|
+
self._client = VersionedClient(headers=headers)
|
|
95
97
|
weakref.finalize(self, self._client.close)
|
|
96
98
|
if warn_if_server_not_running:
|
|
97
99
|
self._warn_if_phoenix_is_not_running()
|
|
@@ -390,7 +392,6 @@ class Client(TraceDataExtractor):
|
|
|
390
392
|
def get_dataset_versions(
|
|
391
393
|
self,
|
|
392
394
|
dataset_id: str,
|
|
393
|
-
/,
|
|
394
395
|
*,
|
|
395
396
|
limit: Optional[int] = 100,
|
|
396
397
|
) -> pd.DataFrame:
|
|
@@ -411,7 +412,7 @@ class Client(TraceDataExtractor):
|
|
|
411
412
|
if not (records := response.json()["data"]):
|
|
412
413
|
return pd.DataFrame()
|
|
413
414
|
df = pd.DataFrame.from_records(records, index="version_id")
|
|
414
|
-
df["created_at"] =
|
|
415
|
+
df["created_at"] = df["created_at"].apply(datetime.fromisoformat)
|
|
415
416
|
return df
|
|
416
417
|
|
|
417
418
|
def upload_dataset(
|
|
@@ -532,11 +533,15 @@ class Client(TraceDataExtractor):
|
|
|
532
533
|
corresponding to an example in the dataset.
|
|
533
534
|
metadata (Iterable[Mapping[str, Any]]): List of dictionaries object each
|
|
534
535
|
corresponding to an example in the dataset.
|
|
535
|
-
dataset_description: (Optional[str]): Description of the dataset.
|
|
536
536
|
|
|
537
537
|
Returns:
|
|
538
538
|
A Dataset object with its examples.
|
|
539
539
|
"""
|
|
540
|
+
if dataset_description is not None:
|
|
541
|
+
warn(
|
|
542
|
+
"The `dataset_description` parameter has been deprecated "
|
|
543
|
+
"and will be removed in a future release."
|
|
544
|
+
)
|
|
540
545
|
if dataframe is not None or csv_file_path is not None:
|
|
541
546
|
if dataframe is not None and csv_file_path is not None:
|
|
542
547
|
raise ValueError(
|
|
@@ -556,7 +561,6 @@ class Client(TraceDataExtractor):
|
|
|
556
561
|
input_keys=input_keys,
|
|
557
562
|
output_keys=output_keys,
|
|
558
563
|
metadata_keys=metadata_keys,
|
|
559
|
-
dataset_description=dataset_description,
|
|
560
564
|
action="append",
|
|
561
565
|
)
|
|
562
566
|
return self._upload_json_dataset(
|
|
@@ -564,7 +568,6 @@ class Client(TraceDataExtractor):
|
|
|
564
568
|
inputs=inputs,
|
|
565
569
|
outputs=outputs,
|
|
566
570
|
metadata=metadata,
|
|
567
|
-
dataset_description=dataset_description,
|
|
568
571
|
action="append",
|
|
569
572
|
)
|
|
570
573
|
|
phoenix/session/session.py
CHANGED
|
@@ -41,13 +41,13 @@ from phoenix.core.model_schema_adapter import create_model_from_inferences
|
|
|
41
41
|
from phoenix.inferences.inferences import EMPTY_INFERENCES, Inferences
|
|
42
42
|
from phoenix.pointcloud.umap_parameters import get_umap_parameters
|
|
43
43
|
from phoenix.server.app import (
|
|
44
|
-
SessionFactory,
|
|
45
44
|
_db,
|
|
46
45
|
create_app,
|
|
47
46
|
create_engine_and_run_migrations,
|
|
48
47
|
instrument_engine_if_enabled,
|
|
49
48
|
)
|
|
50
49
|
from phoenix.server.thread_server import ThreadServer
|
|
50
|
+
from phoenix.server.types import DbSessionFactory
|
|
51
51
|
from phoenix.services import AppService
|
|
52
52
|
from phoenix.session.client import Client
|
|
53
53
|
from phoenix.session.data_extractor import DEFAULT_SPAN_LIMIT, TraceDataExtractor
|
|
@@ -375,7 +375,7 @@ class ThreadSession(Session):
|
|
|
375
375
|
# Initialize an app service that keeps the server running
|
|
376
376
|
engine = create_engine_and_run_migrations(database_url)
|
|
377
377
|
instrumentation_cleanups = instrument_engine_if_enabled(engine)
|
|
378
|
-
factory =
|
|
378
|
+
factory = DbSessionFactory(db=_db(engine), dialect=engine.dialect.name)
|
|
379
379
|
self.app = create_app(
|
|
380
380
|
db=factory,
|
|
381
381
|
export_path=self.export_path,
|
phoenix/trace/dsl/filter.py
CHANGED
|
@@ -5,8 +5,8 @@ import typing
|
|
|
5
5
|
from dataclasses import dataclass, field
|
|
6
6
|
from difflib import SequenceMatcher
|
|
7
7
|
from itertools import chain
|
|
8
|
-
from random import randint
|
|
9
8
|
from types import MappingProxyType
|
|
9
|
+
from uuid import uuid4
|
|
10
10
|
|
|
11
11
|
import sqlalchemy
|
|
12
12
|
from sqlalchemy.orm import Mapped, aliased
|
|
@@ -22,11 +22,14 @@ _VALID_EVAL_ATTRIBUTES: typing.Tuple[str, ...] = tuple(
|
|
|
22
22
|
)
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
AnnotationType: TypeAlias = typing.Literal["annotations", "evals"]
|
|
26
|
+
AnnotationAttribute: TypeAlias = typing.Literal["label", "score"]
|
|
27
|
+
AnnotationExpression: TypeAlias = str
|
|
28
|
+
AnnotationName: TypeAlias = str
|
|
28
29
|
|
|
29
|
-
EVAL_EXPRESSION_PATTERN = re.compile(
|
|
30
|
+
EVAL_EXPRESSION_PATTERN = re.compile(
|
|
31
|
+
r"""\b((annotations|evals)\[(".*?"|'.*?')\][.](label|score))\b"""
|
|
32
|
+
)
|
|
30
33
|
|
|
31
34
|
|
|
32
35
|
@dataclass(frozen=True)
|
|
@@ -46,9 +49,10 @@ class AliasedAnnotationRelation:
|
|
|
46
49
|
|
|
47
50
|
def __post_init__(self) -> None:
|
|
48
51
|
table_alias = f"span_annotation_{self.index}"
|
|
49
|
-
alias_id =
|
|
52
|
+
alias_id = uuid4().hex
|
|
50
53
|
label_attribute_alias = f"{table_alias}_label_{alias_id}"
|
|
51
54
|
score_attribute_alias = f"{table_alias}_score_{alias_id}"
|
|
55
|
+
|
|
52
56
|
table = aliased(models.SpanAnnotation, name=table_alias)
|
|
53
57
|
object.__setattr__(self, "_label_attribute_alias", label_attribute_alias)
|
|
54
58
|
object.__setattr__(self, "_score_attribute_alias", score_attribute_alias)
|
|
@@ -67,7 +71,7 @@ class AliasedAnnotationRelation:
|
|
|
67
71
|
yield self._label_attribute_alias, self.table.label
|
|
68
72
|
yield self._score_attribute_alias, self.table.score
|
|
69
73
|
|
|
70
|
-
def attribute_alias(self, attribute:
|
|
74
|
+
def attribute_alias(self, attribute: AnnotationAttribute) -> str:
|
|
71
75
|
"""
|
|
72
76
|
Returns an alias for the given attribute (i.e., column).
|
|
73
77
|
"""
|
|
@@ -579,7 +583,7 @@ def _validate_expression(
|
|
|
579
583
|
_is_subscript(node, "metadata") or _is_subscript(node, "attributes")
|
|
580
584
|
) and _get_attribute_keys_list(node) is not None:
|
|
581
585
|
continue
|
|
582
|
-
elif
|
|
586
|
+
elif _is_annotation(node) and _get_subscript_key(node) is not None:
|
|
583
587
|
# e.g. `evals["name"]`
|
|
584
588
|
if not (eval_name := _get_subscript_key(node)) or (
|
|
585
589
|
valid_eval_names is not None and eval_name not in valid_eval_names
|
|
@@ -601,7 +605,7 @@ def _validate_expression(
|
|
|
601
605
|
else ""
|
|
602
606
|
)
|
|
603
607
|
continue
|
|
604
|
-
elif isinstance(node, ast.Attribute) and
|
|
608
|
+
elif isinstance(node, ast.Attribute) and _is_annotation(node.value):
|
|
605
609
|
# e.g. `evals["name"].score`
|
|
606
610
|
if (attr := node.attr) not in valid_eval_attributes:
|
|
607
611
|
source_segment = typing.cast(str, ast.get_source_segment(source, node))
|
|
@@ -662,19 +666,19 @@ def _as_attribute(
|
|
|
662
666
|
) -> ast.Subscript:
|
|
663
667
|
return ast.Subscript(
|
|
664
668
|
value=ast.Name(id="attributes", ctx=ast.Load()),
|
|
665
|
-
slice=ast.List(elts=keys, ctx=ast.Load())
|
|
669
|
+
slice=ast.List(elts=keys, ctx=ast.Load()) # type: ignore[arg-type]
|
|
666
670
|
if sys.version_info >= (3, 9)
|
|
667
|
-
else ast.Index(value=ast.List(elts=keys, ctx=ast.Load())),
|
|
671
|
+
else ast.Index(value=ast.List(elts=keys, ctx=ast.Load())), # type: ignore
|
|
668
672
|
ctx=ast.Load(),
|
|
669
673
|
)
|
|
670
674
|
|
|
671
675
|
|
|
672
|
-
def
|
|
676
|
+
def _is_annotation(node: typing.Any) -> TypeGuard[ast.Subscript]:
|
|
673
677
|
# e.g. `evals["name"]`
|
|
674
678
|
return (
|
|
675
679
|
isinstance(node, ast.Subscript)
|
|
676
680
|
and isinstance(value := node.value, ast.Name)
|
|
677
|
-
and value.id
|
|
681
|
+
and value.id in ["evals", "annotations"]
|
|
678
682
|
)
|
|
679
683
|
|
|
680
684
|
|
|
@@ -817,34 +821,45 @@ def _apply_eval_aliasing(
|
|
|
817
821
|
span_annotation_0_label_123 == 'correct' or span_annotation_0_score_456 < 0.5
|
|
818
822
|
```
|
|
819
823
|
"""
|
|
820
|
-
eval_aliases: typing.Dict[
|
|
821
|
-
for
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
824
|
+
eval_aliases: typing.Dict[AnnotationName, AliasedAnnotationRelation] = {}
|
|
825
|
+
for (
|
|
826
|
+
annotation_expression,
|
|
827
|
+
annotation_type,
|
|
828
|
+
annotation_name,
|
|
829
|
+
annotation_attribute,
|
|
830
|
+
) in _parse_annotation_expressions_and_names(source):
|
|
831
|
+
if (eval_alias := eval_aliases.get(annotation_name)) is None:
|
|
832
|
+
eval_alias = AliasedAnnotationRelation(index=len(eval_aliases), name=annotation_name)
|
|
833
|
+
eval_aliases[annotation_name] = eval_alias
|
|
834
|
+
alias_name = eval_alias.attribute_alias(annotation_attribute)
|
|
835
|
+
source = source.replace(annotation_expression, alias_name)
|
|
827
836
|
return source, tuple(eval_aliases.values())
|
|
828
837
|
|
|
829
838
|
|
|
830
|
-
def
|
|
839
|
+
def _parse_annotation_expressions_and_names(
|
|
831
840
|
source: str,
|
|
832
|
-
) -> typing.Iterator[
|
|
841
|
+
) -> typing.Iterator[
|
|
842
|
+
typing.Tuple[AnnotationExpression, AnnotationType, AnnotationName, AnnotationAttribute]
|
|
843
|
+
]:
|
|
833
844
|
"""
|
|
834
845
|
Parses filter conditions for evaluation expressions of the form:
|
|
835
846
|
|
|
836
847
|
```
|
|
837
848
|
evals["<eval-name>"].<attribute>
|
|
849
|
+
annotations["eval-name"].<attribute>
|
|
838
850
|
```
|
|
839
851
|
"""
|
|
840
852
|
for match in EVAL_EXPRESSION_PATTERN.finditer(source):
|
|
841
853
|
(
|
|
842
|
-
|
|
854
|
+
annotation_expression,
|
|
855
|
+
annotation_type,
|
|
843
856
|
quoted_eval_name,
|
|
844
857
|
evaluation_attribute_name,
|
|
845
858
|
) = match.groups()
|
|
859
|
+
annotation_type = typing.cast(AnnotationType, annotation_type)
|
|
846
860
|
yield (
|
|
847
|
-
|
|
861
|
+
annotation_expression,
|
|
862
|
+
annotation_type,
|
|
848
863
|
quoted_eval_name[1:-1],
|
|
849
|
-
typing.cast(
|
|
864
|
+
typing.cast(AnnotationAttribute, evaluation_attribute_name),
|
|
850
865
|
)
|
phoenix/trace/fixtures.py
CHANGED
|
@@ -8,7 +8,6 @@ from random import getrandbits
|
|
|
8
8
|
from tempfile import NamedTemporaryFile
|
|
9
9
|
from time import sleep, time
|
|
10
10
|
from typing import Dict, Iterable, Iterator, List, NamedTuple, Optional, Sequence, Tuple, cast
|
|
11
|
-
from urllib import request
|
|
12
11
|
from urllib.parse import urljoin
|
|
13
12
|
|
|
14
13
|
import httpx
|
|
@@ -20,7 +19,7 @@ import phoenix.trace.v1 as pb
|
|
|
20
19
|
from phoenix import Client
|
|
21
20
|
from phoenix.trace.schemas import Span
|
|
22
21
|
from phoenix.trace.trace_dataset import TraceDataset
|
|
23
|
-
from phoenix.trace.utils import json_lines_to_df
|
|
22
|
+
from phoenix.trace.utils import download_json_traces_fixture, is_jsonl_file, json_lines_to_df
|
|
24
23
|
|
|
25
24
|
logger = logging.getLogger(__name__)
|
|
26
25
|
|
|
@@ -86,7 +85,7 @@ class TracesFixture:
|
|
|
86
85
|
llama_index_rag_fixture = TracesFixture(
|
|
87
86
|
name="llama_index_rag",
|
|
88
87
|
description="Traces from running the llama_index on a RAG use case.",
|
|
89
|
-
file_name="llama_index_rag_v8.
|
|
88
|
+
file_name="llama_index_rag_v8.parquet",
|
|
90
89
|
evaluation_fixtures=(
|
|
91
90
|
EvaluationFixture(
|
|
92
91
|
evaluation_name="Q&A Correctness",
|
|
@@ -136,31 +135,31 @@ llama_index_rag_fixture = TracesFixture(
|
|
|
136
135
|
llama_index_calculator_agent_fixture = TracesFixture(
|
|
137
136
|
name="llama_index_calculator_agent",
|
|
138
137
|
description="Traces from running the llama_index with calculator tools.",
|
|
139
|
-
file_name="llama_index_calculator_agent_v3.
|
|
138
|
+
file_name="llama_index_calculator_agent_v3.parquet",
|
|
140
139
|
)
|
|
141
140
|
|
|
142
141
|
llama_index_rag_fixture_with_davinci = TracesFixture(
|
|
143
142
|
name="llama_index_rag_with_davinci",
|
|
144
143
|
description="Traces from running llama_index on a RAG use case with the completions API.",
|
|
145
|
-
file_name="llama_index_rag_with_davinci_v0.
|
|
144
|
+
file_name="llama_index_rag_with_davinci_v0.parquet",
|
|
146
145
|
)
|
|
147
146
|
|
|
148
147
|
langchain_rag_stuff_document_chain_fixture = TracesFixture(
|
|
149
148
|
name="langchain_rag_stuff_document_chain",
|
|
150
149
|
description="LangChain RAG data",
|
|
151
|
-
file_name="langchain_rag.
|
|
150
|
+
file_name="langchain_rag.parquet",
|
|
152
151
|
)
|
|
153
152
|
|
|
154
153
|
langchain_titanic_csv_agent_evaluator_fixture = TracesFixture(
|
|
155
154
|
name="lc_titanic",
|
|
156
155
|
description="LangChain titanic.csv Agent Evaluator",
|
|
157
|
-
file_name="lc_titanic.
|
|
156
|
+
file_name="lc_titanic.parquet",
|
|
158
157
|
)
|
|
159
158
|
|
|
160
159
|
langchain_qa_with_sources_fixture = TracesFixture(
|
|
161
160
|
name="langchain_qa_with_sources",
|
|
162
161
|
description="LangChain QA with sources on financial data",
|
|
163
|
-
file_name="langchain_qa_with_sources_chain.
|
|
162
|
+
file_name="langchain_qa_with_sources_chain.parquet",
|
|
164
163
|
)
|
|
165
164
|
|
|
166
165
|
random_fixture = TracesFixture(
|
|
@@ -197,26 +196,21 @@ def get_trace_fixture_by_name(fixture_name: str) -> TracesFixture:
|
|
|
197
196
|
return NAME_TO_TRACES_FIXTURE[fixture_name]
|
|
198
197
|
|
|
199
198
|
|
|
200
|
-
def download_traces_fixture(
|
|
201
|
-
fixture: TracesFixture,
|
|
202
|
-
host: Optional[str] = "https://storage.googleapis.com/",
|
|
203
|
-
bucket: Optional[str] = "arize-assets",
|
|
204
|
-
prefix: Optional[str] = "phoenix/traces/",
|
|
205
|
-
) -> List[str]:
|
|
206
|
-
"""
|
|
207
|
-
Downloads the traces fixture from the phoenix bucket.
|
|
208
|
-
"""
|
|
209
|
-
url = f"{host}{bucket}/{prefix}{fixture.file_name}"
|
|
210
|
-
with request.urlopen(url) as f:
|
|
211
|
-
return cast(List[str], f.readlines())
|
|
212
|
-
|
|
213
|
-
|
|
214
199
|
def load_example_traces(fixture_name: str) -> TraceDataset:
|
|
215
200
|
"""
|
|
216
201
|
Loads a trace dataframe by name.
|
|
217
202
|
"""
|
|
203
|
+
host = "https://storage.googleapis.com/"
|
|
204
|
+
bucket = "arize-phoenix-assets"
|
|
205
|
+
prefix = "traces/"
|
|
218
206
|
fixture = get_trace_fixture_by_name(fixture_name)
|
|
219
|
-
|
|
207
|
+
|
|
208
|
+
url = f"{host}{bucket}/{prefix}{fixture.file_name}"
|
|
209
|
+
|
|
210
|
+
if is_jsonl_file(fixture.file_name):
|
|
211
|
+
return TraceDataset(json_lines_to_df(download_json_traces_fixture(url)))
|
|
212
|
+
|
|
213
|
+
return TraceDataset(pd.read_parquet(url))
|
|
220
214
|
|
|
221
215
|
|
|
222
216
|
def get_dataset_fixtures(fixture_name: str) -> Iterable[DatasetFixture]:
|
phoenix/trace/utils.py
CHANGED
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import os
|
|
2
3
|
import re
|
|
3
4
|
from traceback import format_exception
|
|
4
5
|
from typing import List, Optional, Tuple, cast
|
|
6
|
+
from urllib import request
|
|
5
7
|
|
|
6
8
|
import pandas as pd
|
|
7
9
|
|
|
8
10
|
|
|
11
|
+
def is_jsonl_file(file_path: str) -> bool:
|
|
12
|
+
"""
|
|
13
|
+
Check if the given file is a Parquet file.
|
|
14
|
+
"""
|
|
15
|
+
file_extension = os.path.splitext(file_path)[-1]
|
|
16
|
+
if file_extension == ".jsonl":
|
|
17
|
+
return True
|
|
18
|
+
return False
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def download_json_traces_fixture(
|
|
22
|
+
url: str,
|
|
23
|
+
) -> List[str]:
|
|
24
|
+
"""
|
|
25
|
+
Stores the traces fixture as list of jsons from the jsonl files in the phoenix bucket.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
with request.urlopen(url) as f:
|
|
29
|
+
return cast(List[str], f.readlines())
|
|
30
|
+
|
|
31
|
+
|
|
9
32
|
def json_lines_to_df(lines: List[str]) -> pd.DataFrame:
|
|
10
33
|
"""
|
|
11
34
|
Convert a list of JSON line strings to a Pandas DataFrame.
|