arize-phoenix 0.0.2rc3__py3-none-any.whl → 0.0.2rc5__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-0.0.2rc3.dist-info → arize_phoenix-0.0.2rc5.dist-info}/METADATA +25 -21
- {arize_phoenix-0.0.2rc3.dist-info → arize_phoenix-0.0.2rc5.dist-info}/RECORD +25 -26
- phoenix/__about__.py +1 -1
- phoenix/__init__.py +2 -2
- phoenix/core/embedding_dimension.py +33 -0
- phoenix/datasets/__init__.py +2 -1
- phoenix/datasets/dataset.py +31 -4
- phoenix/{server → datasets}/fixtures.py +47 -10
- phoenix/datasets/validation.py +1 -1
- phoenix/metrics/metrics.py +29 -5
- phoenix/metrics/mixins.py +11 -3
- phoenix/metrics/timeseries.py +11 -7
- phoenix/pointcloud/clustering.py +3 -3
- phoenix/pointcloud/pointcloud.py +9 -7
- phoenix/server/api/input_types/Granularity.py +2 -0
- phoenix/server/api/interceptor.py +28 -0
- phoenix/server/api/types/Dimension.py +23 -33
- phoenix/server/api/types/EmbeddingDimension.py +39 -111
- phoenix/server/api/types/TimeSeries.py +117 -3
- phoenix/server/api/types/UMAPPoints.py +62 -14
- phoenix/server/main.py +3 -3
- phoenix/server/static/index.js +720 -634
- phoenix/session/session.py +48 -6
- phoenix/server/api/types/DataQualityTimeSeries.py +0 -36
- phoenix/server/api/types/DriftTimeSeries.py +0 -10
- {arize_phoenix-0.0.2rc3.dist-info → arize_phoenix-0.0.2rc5.dist-info}/WHEEL +0 -0
- {arize_phoenix-0.0.2rc3.dist-info → arize_phoenix-0.0.2rc5.dist-info}/licenses/LICENSE +0 -0
phoenix/session/session.py
CHANGED
|
@@ -35,8 +35,16 @@ class Session:
|
|
|
35
35
|
)
|
|
36
36
|
self._is_colab = _is_colab()
|
|
37
37
|
|
|
38
|
-
def view(self, height: int =
|
|
39
|
-
|
|
38
|
+
def view(self, height: int = 1000) -> "IFrame":
|
|
39
|
+
"""
|
|
40
|
+
Returns an IFrame that can be displayed in a notebook to view the app.
|
|
41
|
+
|
|
42
|
+
Parameters
|
|
43
|
+
----------
|
|
44
|
+
height : int, optional
|
|
45
|
+
The height of the IFrame in pixels. Defaults to 1000.
|
|
46
|
+
"""
|
|
47
|
+
print(f"📺 Opening a view to the Phoenix app. The app is running at {self.url}")
|
|
40
48
|
return IFrame(src=self.url, width="100%", height=height)
|
|
41
49
|
|
|
42
50
|
@cached_property
|
|
@@ -72,20 +80,54 @@ def _wait_for_boot(url: str, polling_interval_secs: int = 1, max_retries: int =
|
|
|
72
80
|
|
|
73
81
|
|
|
74
82
|
def launch_app(
|
|
75
|
-
primary: Dataset, reference: Optional[Dataset], wait_for_boot: Optional[bool] = True
|
|
83
|
+
primary: Dataset, reference: Optional[Dataset] = None, wait_for_boot: Optional[bool] = True
|
|
76
84
|
) -> "Session":
|
|
77
|
-
"
|
|
85
|
+
"""
|
|
86
|
+
Launches the phoenix application and returns a session to interact with.
|
|
87
|
+
|
|
88
|
+
Parameters
|
|
89
|
+
----------
|
|
90
|
+
primary : Dataset required
|
|
91
|
+
The primary dataset to analyze
|
|
92
|
+
reference : Dataset, optional
|
|
93
|
+
The reference dataset to compare against.
|
|
94
|
+
If not provided, drift analysis will not be available.
|
|
95
|
+
|
|
96
|
+
Returns
|
|
97
|
+
-------
|
|
98
|
+
session : Session
|
|
99
|
+
The session object that can be used to view the application
|
|
100
|
+
|
|
101
|
+
Examples
|
|
102
|
+
--------
|
|
103
|
+
>>> import phoenix as px
|
|
104
|
+
>>> # construct a dataset to analyze
|
|
105
|
+
>>> dataset = px.Dataset(...)
|
|
106
|
+
>>> session = px.launch_app(dataset)
|
|
107
|
+
"""
|
|
78
108
|
global _session
|
|
79
109
|
|
|
80
110
|
_session = Session(primary, reference, port=config.port)
|
|
81
111
|
if wait_for_boot:
|
|
82
112
|
_wait_for_boot(_session.url)
|
|
113
|
+
print(f"🌍 To view the Phoenix app in your browser, visit {_session.url}")
|
|
114
|
+
print("📺 To view the Phoenix app in a notebook, run `px.active_session().view()`")
|
|
115
|
+
print("📖 For more information on how to use Phoenix, check out https://docs.arize.com/phoenix")
|
|
116
|
+
return _session
|
|
117
|
+
|
|
83
118
|
|
|
119
|
+
def active_session() -> Optional["Session"]:
|
|
120
|
+
"""
|
|
121
|
+
Returns the active session if one exists, otherwise returns None
|
|
122
|
+
"""
|
|
84
123
|
return _session
|
|
85
124
|
|
|
86
125
|
|
|
87
126
|
def close_app() -> None:
|
|
88
|
-
"
|
|
127
|
+
"""
|
|
128
|
+
Closes the phoenix application.
|
|
129
|
+
The application server is shut down and will no longer be accessible.
|
|
130
|
+
"""
|
|
89
131
|
global _session
|
|
90
132
|
if _session is None:
|
|
91
133
|
print("No active session to close")
|
|
@@ -96,7 +138,7 @@ def close_app() -> None:
|
|
|
96
138
|
|
|
97
139
|
|
|
98
140
|
def _get_url(port: int, is_colab: bool) -> str:
|
|
99
|
-
"""Determines the iframe url based on whether this is in a
|
|
141
|
+
"""Determines the iframe url based on whether this is in a colab or in a local notebook"""
|
|
100
142
|
if is_colab:
|
|
101
143
|
from google.colab.output import eval_js # type: ignore
|
|
102
144
|
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import math
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
from typing import Iterable, cast
|
|
4
|
-
|
|
5
|
-
import pandas as pd
|
|
6
|
-
import strawberry
|
|
7
|
-
|
|
8
|
-
from phoenix.metrics import Metric
|
|
9
|
-
|
|
10
|
-
from .TimeSeries import TimeSeries, TimeSeriesDataPoint
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@strawberry.type
|
|
14
|
-
class DataQualityTimeSeries(TimeSeries):
|
|
15
|
-
"""A time series of data quality metrics"""
|
|
16
|
-
|
|
17
|
-
...
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def to_gql_timeseries(
|
|
21
|
-
df: pd.DataFrame, metric: Metric, timestamps: Iterable[datetime]
|
|
22
|
-
) -> DataQualityTimeSeries:
|
|
23
|
-
data = []
|
|
24
|
-
for timestamp in timestamps:
|
|
25
|
-
try:
|
|
26
|
-
row = df.iloc[cast(int, df.index.get_loc(timestamp)), :].to_dict()
|
|
27
|
-
except KeyError:
|
|
28
|
-
row = {}
|
|
29
|
-
value = metric.get_value(row)
|
|
30
|
-
data.append(
|
|
31
|
-
TimeSeriesDataPoint(
|
|
32
|
-
timestamp=timestamp,
|
|
33
|
-
value=None if math.isnan(value) else value,
|
|
34
|
-
)
|
|
35
|
-
)
|
|
36
|
-
return DataQualityTimeSeries(data=sorted(data))
|
|
File without changes
|
|
File without changes
|