arize-phoenix 4.22.0__py3-none-any.whl → 4.23.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.

Files changed (34) hide show
  1. {arize_phoenix-4.22.0.dist-info → arize_phoenix-4.23.0.dist-info}/METADATA +1 -1
  2. {arize_phoenix-4.22.0.dist-info → arize_phoenix-4.23.0.dist-info}/RECORD +30 -32
  3. phoenix/experiments/functions.py +4 -4
  4. phoenix/experiments/types.py +3 -3
  5. phoenix/server/api/context.py +0 -6
  6. phoenix/server/api/dataloaders/__init__.py +0 -9
  7. phoenix/server/api/mutations/dataset_mutations.py +52 -12
  8. phoenix/server/api/queries.py +30 -0
  9. phoenix/server/api/routers/v1/experiment_runs.py +7 -2
  10. phoenix/server/api/types/Evaluation.py +1 -26
  11. phoenix/server/api/types/Project.py +1 -60
  12. phoenix/server/api/types/Span.py +21 -11
  13. phoenix/server/api/types/User.py +13 -0
  14. phoenix/server/app.py +5 -11
  15. phoenix/server/dml_event_handler.py +0 -3
  16. phoenix/server/main.py +12 -0
  17. phoenix/server/static/.vite/manifest.json +31 -31
  18. phoenix/server/static/assets/{components-Bhx3QVW0.js → components-DBYPF96c.js} +48 -48
  19. phoenix/server/static/assets/index-DNxu4viw.js +100 -0
  20. phoenix/server/static/assets/{pages-DG-5zgoV.js → pages-BhOnrUmC.js} +229 -204
  21. phoenix/server/static/assets/{vendor-BMWfu6zp.js → vendor-CIqy43_9.js} +1 -1
  22. phoenix/server/static/assets/{vendor-arizeai-Sj74jm5V.js → vendor-arizeai-B1YgcWL8.js} +1 -1
  23. phoenix/server/static/assets/{vendor-codemirror-DO3VqEcD.js → vendor-codemirror-_bcwCA1C.js} +1 -1
  24. phoenix/server/static/assets/{vendor-recharts-BGN0SxgJ.js → vendor-recharts-C3pM_Wlg.js} +1 -1
  25. phoenix/server/templates/index.html +2 -1
  26. phoenix/session/session.py +1 -0
  27. phoenix/version.py +1 -1
  28. phoenix/server/api/dataloaders/evaluation_summaries.py +0 -149
  29. phoenix/server/api/dataloaders/span_evaluations.py +0 -35
  30. phoenix/server/api/dataloaders/trace_evaluations.py +0 -35
  31. phoenix/server/static/assets/index-CZg-95kd.js +0 -100
  32. {arize_phoenix-4.22.0.dist-info → arize_phoenix-4.23.0.dist-info}/WHEEL +0 -0
  33. {arize_phoenix-4.22.0.dist-info → arize_phoenix-4.23.0.dist-info}/licenses/IP_NOTICE +0 -0
  34. {arize_phoenix-4.22.0.dist-info → arize_phoenix-4.23.0.dist-info}/licenses/LICENSE +0 -0
@@ -28,7 +28,7 @@ from phoenix.server.api.types.SpanAnnotation import to_gql_span_annotation
28
28
  from phoenix.trace.attributes import get_attribute_value
29
29
 
30
30
  from .DocumentRetrievalMetrics import DocumentRetrievalMetrics
31
- from .Evaluation import DocumentEvaluation, SpanEvaluation
31
+ from .Evaluation import DocumentEvaluation
32
32
  from .ExampleRevisionInterface import ExampleRevision
33
33
  from .MimeType import MimeType
34
34
  from .SpanAnnotation import SpanAnnotation
@@ -170,14 +170,6 @@ class Span(Node):
170
170
  "codes from descendant spans (children, grandchildren, etc.)",
171
171
  )
172
172
 
173
- @strawberry.field(
174
- description="Evaluations associated with the span, e.g. if the span is "
175
- "an LLM, an evaluation may assess the helpfulness of its response with "
176
- "respect to its input."
177
- ) # type: ignore
178
- async def span_evaluations(self, info: Info[Context, None]) -> List[SpanEvaluation]:
179
- return await info.context.data_loaders.span_evaluations.load(self.id_attr)
180
-
181
173
  @strawberry.field(
182
174
  description=(
183
175
  "Annotations associated with the span. This encompasses both "
@@ -240,7 +232,7 @@ class Span(Node):
240
232
  @strawberry.field(
241
233
  description="The span's attributes translated into an example revision for a dataset",
242
234
  ) # type: ignore
243
- def as_example_revision(self) -> SpanAsExampleRevision:
235
+ async def as_example_revision(self, info: Info[Context, None]) -> SpanAsExampleRevision:
244
236
  db_span = self.db_span
245
237
  attributes = db_span.attributes
246
238
  span_io = _SpanIO(
@@ -256,10 +248,28 @@ class Span(Node):
256
248
  llm_output_messages=get_attribute_value(attributes, LLM_OUTPUT_MESSAGES),
257
249
  retrieval_documents=get_attribute_value(attributes, RETRIEVAL_DOCUMENTS),
258
250
  )
251
+
252
+ # Fetch annotations associated with this span
253
+ span_annotations = await self.span_annotations(info)
254
+ annotations = dict()
255
+ for annotation in span_annotations:
256
+ annotations[annotation.name] = {
257
+ "label": annotation.label,
258
+ "score": annotation.score,
259
+ "explanation": annotation.explanation,
260
+ "metadata": annotation.metadata,
261
+ "annotator_kind": annotation.annotator_kind.value,
262
+ }
263
+ # Merge annotations into the metadata
264
+ metadata = {
265
+ **attributes,
266
+ "annotations": annotations,
267
+ }
268
+
259
269
  return SpanAsExampleRevision(
260
270
  input=get_dataset_example_input(span_io),
261
271
  output=get_dataset_example_output(span_io),
262
- metadata=attributes,
272
+ metadata=metadata,
263
273
  )
264
274
 
265
275
  @strawberry.field(description="The project that this span belongs to.") # type: ignore
@@ -0,0 +1,13 @@
1
+ from datetime import datetime
2
+ from typing import Optional
3
+
4
+ import strawberry
5
+ from strawberry.relay import Node, NodeID
6
+
7
+
8
+ @strawberry.type
9
+ class User(Node):
10
+ id_attr: NodeID[int]
11
+ email: str
12
+ username: Optional[str]
13
+ created_at: datetime
phoenix/server/app.py CHANGED
@@ -65,7 +65,6 @@ from phoenix.server.api.dataloaders import (
65
65
  DocumentEvaluationsDataLoader,
66
66
  DocumentEvaluationSummaryDataLoader,
67
67
  DocumentRetrievalMetricsDataLoader,
68
- EvaluationSummaryDataLoader,
69
68
  ExperimentAnnotationSummaryDataLoader,
70
69
  ExperimentErrorRatesDataLoader,
71
70
  ExperimentRunCountsDataLoader,
@@ -77,10 +76,8 @@ from phoenix.server.api.dataloaders import (
77
76
  SpanAnnotationsDataLoader,
78
77
  SpanDatasetExamplesDataLoader,
79
78
  SpanDescendantsDataLoader,
80
- SpanEvaluationsDataLoader,
81
79
  SpanProjectsDataLoader,
82
80
  TokenCountDataLoader,
83
- TraceEvaluationsDataLoader,
84
81
  TraceRowIdsDataLoader,
85
82
  )
86
83
  from phoenix.server.api.routers.v1 import REST_API_VERSION
@@ -118,6 +115,8 @@ class AppConfig(NamedTuple):
118
115
  n_samples: int
119
116
  is_development: bool
120
117
  web_manifest_path: Path
118
+ authentication_enabled: bool
119
+ """ Whether authentication is enabled """
121
120
 
122
121
 
123
122
  class Static(StaticFiles):
@@ -165,6 +164,7 @@ class Static(StaticFiles):
165
164
  "request": request,
166
165
  "is_development": self._app_config.is_development,
167
166
  "manifest": self._web_manifest,
167
+ "authentication_enabled": self._app_config.authentication_enabled,
168
168
  },
169
169
  )
170
170
  except Exception as e:
@@ -303,12 +303,6 @@ def create_graphql_router(
303
303
  if cache_for_dataloaders
304
304
  else None,
305
305
  ),
306
- evaluation_summaries=EvaluationSummaryDataLoader(
307
- db,
308
- cache_map=cache_for_dataloaders.evaluation_summary
309
- if cache_for_dataloaders
310
- else None,
311
- ),
312
306
  experiment_annotation_summaries=ExperimentAnnotationSummaryDataLoader(db),
313
307
  experiment_error_rates=ExperimentErrorRatesDataLoader(db),
314
308
  experiment_run_counts=ExperimentRunCountsDataLoader(db),
@@ -332,13 +326,11 @@ def create_graphql_router(
332
326
  span_annotations=SpanAnnotationsDataLoader(db),
333
327
  span_dataset_examples=SpanDatasetExamplesDataLoader(db),
334
328
  span_descendants=SpanDescendantsDataLoader(db),
335
- span_evaluations=SpanEvaluationsDataLoader(db),
336
329
  span_projects=SpanProjectsDataLoader(db),
337
330
  token_counts=TokenCountDataLoader(
338
331
  db,
339
332
  cache_map=cache_for_dataloaders.token_count if cache_for_dataloaders else None,
340
333
  ),
341
- trace_evaluations=TraceEvaluationsDataLoader(db),
342
334
  trace_row_ids=TraceRowIdsDataLoader(db),
343
335
  project_by_name=ProjectByNameDataLoader(db),
344
336
  ),
@@ -406,6 +398,7 @@ def create_app(
406
398
  db: DbSessionFactory,
407
399
  export_path: Path,
408
400
  model: Model,
401
+ authentication_enabled: bool,
409
402
  umap_params: UMAPParameters,
410
403
  corpus: Optional[Model] = None,
411
404
  debug: bool = False,
@@ -526,6 +519,7 @@ def create_app(
526
519
  n_neighbors=umap_params.n_neighbors,
527
520
  n_samples=umap_params.n_samples,
528
521
  is_development=dev,
522
+ authentication_enabled=authentication_enabled,
529
523
  web_manifest_path=SERVER_DIR / "static" / ".vite" / "manifest.json",
530
524
  ),
531
525
  ),
@@ -142,7 +142,6 @@ class _SpanDeleteEventHandler(_SpanDmlEventHandler):
142
142
  @staticmethod
143
143
  def _clear(cache: CacheForDataLoaders, project_id: int) -> None:
144
144
  cache.annotation_summary.invalidate_project(project_id)
145
- cache.evaluation_summary.invalidate_project(project_id)
146
145
  cache.document_evaluation_summary.invalidate_project(project_id)
147
146
 
148
147
 
@@ -201,7 +200,6 @@ class _SpanAnnotationDmlEventHandler(_AnnotationDmlEventHandler[SpanAnnotationDm
201
200
  @staticmethod
202
201
  def _clear(cache: CacheForDataLoaders, project_id: int, name: str) -> None:
203
202
  cache.annotation_summary.invalidate((project_id, name, "span"))
204
- cache.evaluation_summary.invalidate((project_id, name, "span"))
205
203
 
206
204
 
207
205
  class _TraceAnnotationDmlEventHandler(_AnnotationDmlEventHandler[TraceAnnotationDmlEvent]):
@@ -214,7 +212,6 @@ class _TraceAnnotationDmlEventHandler(_AnnotationDmlEventHandler[TraceAnnotation
214
212
  @staticmethod
215
213
  def _clear(cache: CacheForDataLoaders, project_id: int, name: str) -> None:
216
214
  cache.annotation_summary.invalidate((project_id, name, "trace"))
217
- cache.evaluation_summary.invalidate((project_id, name, "trace"))
218
215
 
219
216
 
220
217
  class _DocumentAnnotationDmlEventHandler(_AnnotationDmlEventHandler[DocumentAnnotationDmlEvent]):
phoenix/server/main.py CHANGED
@@ -13,6 +13,7 @@ from uvicorn import Config, Server
13
13
  import phoenix.trace.v1 as pb
14
14
  from phoenix.config import (
15
15
  EXPORT_DIR,
16
+ get_auth_settings,
16
17
  get_env_database_connection_str,
17
18
  get_env_enable_prometheus,
18
19
  get_env_grpc_port,
@@ -80,6 +81,11 @@ _WELCOME_MESSAGE = """
80
81
  | Storage: {storage}
81
82
  """
82
83
 
84
+ _EXPERIMENTAL_WARNING = """
85
+ 🚨 WARNING: Phoenix is running in experimental mode. 🚨
86
+ | Authentication enabled: {auth_enabled}
87
+ """
88
+
83
89
 
84
90
  def _write_pid_file_when_ready(
85
91
  server: Server,
@@ -212,6 +218,8 @@ if __name__ == "__main__":
212
218
  reference_inferences,
213
219
  )
214
220
 
221
+ authentication_enabled, auth_secret = get_auth_settings()
222
+
215
223
  fixture_spans: List[Span] = []
216
224
  fixture_evals: List[pb.Evaluation] = []
217
225
  if trace_dataset_name is not None:
@@ -251,6 +259,7 @@ if __name__ == "__main__":
251
259
  db=factory,
252
260
  export_path=export_path,
253
261
  model=model,
262
+ authentication_enabled=authentication_enabled,
254
263
  umap_params=umap_params,
255
264
  corpus=None
256
265
  if corpus_inferences is None
@@ -278,5 +287,8 @@ if __name__ == "__main__":
278
287
  )
279
288
  )
280
289
 
290
+ if authentication_enabled:
291
+ print(_EXPERIMENTAL_WARNING.format(auth_enabled=authentication_enabled))
292
+
281
293
  # Start the server
282
294
  server.run()
@@ -1,32 +1,32 @@
1
1
  {
2
- "_components-Bhx3QVW0.js": {
3
- "file": "assets/components-Bhx3QVW0.js",
2
+ "_components-DBYPF96c.js": {
3
+ "file": "assets/components-DBYPF96c.js",
4
4
  "name": "components",
5
5
  "imports": [
6
- "_vendor-BMWfu6zp.js",
7
- "_vendor-arizeai-Sj74jm5V.js",
8
- "_pages-DG-5zgoV.js",
6
+ "_vendor-CIqy43_9.js",
7
+ "_vendor-arizeai-B1YgcWL8.js",
8
+ "_pages-BhOnrUmC.js",
9
9
  "_vendor-three-DwGkEfCM.js",
10
- "_vendor-codemirror-DO3VqEcD.js"
10
+ "_vendor-codemirror-_bcwCA1C.js"
11
11
  ]
12
12
  },
13
- "_pages-DG-5zgoV.js": {
14
- "file": "assets/pages-DG-5zgoV.js",
13
+ "_pages-BhOnrUmC.js": {
14
+ "file": "assets/pages-BhOnrUmC.js",
15
15
  "name": "pages",
16
16
  "imports": [
17
- "_vendor-BMWfu6zp.js",
18
- "_components-Bhx3QVW0.js",
19
- "_vendor-arizeai-Sj74jm5V.js",
20
- "_vendor-recharts-BGN0SxgJ.js",
21
- "_vendor-codemirror-DO3VqEcD.js"
17
+ "_vendor-CIqy43_9.js",
18
+ "_components-DBYPF96c.js",
19
+ "_vendor-arizeai-B1YgcWL8.js",
20
+ "_vendor-recharts-C3pM_Wlg.js",
21
+ "_vendor-codemirror-_bcwCA1C.js"
22
22
  ]
23
23
  },
24
24
  "_vendor-!~{003}~.js": {
25
25
  "file": "assets/vendor-DxkFTwjz.css",
26
26
  "src": "_vendor-!~{003}~.js"
27
27
  },
28
- "_vendor-BMWfu6zp.js": {
29
- "file": "assets/vendor-BMWfu6zp.js",
28
+ "_vendor-CIqy43_9.js": {
29
+ "file": "assets/vendor-CIqy43_9.js",
30
30
  "name": "vendor",
31
31
  "imports": [
32
32
  "_vendor-three-DwGkEfCM.js"
@@ -35,25 +35,25 @@
35
35
  "assets/vendor-DxkFTwjz.css"
36
36
  ]
37
37
  },
38
- "_vendor-arizeai-Sj74jm5V.js": {
39
- "file": "assets/vendor-arizeai-Sj74jm5V.js",
38
+ "_vendor-arizeai-B1YgcWL8.js": {
39
+ "file": "assets/vendor-arizeai-B1YgcWL8.js",
40
40
  "name": "vendor-arizeai",
41
41
  "imports": [
42
- "_vendor-BMWfu6zp.js"
42
+ "_vendor-CIqy43_9.js"
43
43
  ]
44
44
  },
45
- "_vendor-codemirror-DO3VqEcD.js": {
46
- "file": "assets/vendor-codemirror-DO3VqEcD.js",
45
+ "_vendor-codemirror-_bcwCA1C.js": {
46
+ "file": "assets/vendor-codemirror-_bcwCA1C.js",
47
47
  "name": "vendor-codemirror",
48
48
  "imports": [
49
- "_vendor-BMWfu6zp.js"
49
+ "_vendor-CIqy43_9.js"
50
50
  ]
51
51
  },
52
- "_vendor-recharts-BGN0SxgJ.js": {
53
- "file": "assets/vendor-recharts-BGN0SxgJ.js",
52
+ "_vendor-recharts-C3pM_Wlg.js": {
53
+ "file": "assets/vendor-recharts-C3pM_Wlg.js",
54
54
  "name": "vendor-recharts",
55
55
  "imports": [
56
- "_vendor-BMWfu6zp.js"
56
+ "_vendor-CIqy43_9.js"
57
57
  ]
58
58
  },
59
59
  "_vendor-three-DwGkEfCM.js": {
@@ -61,18 +61,18 @@
61
61
  "name": "vendor-three"
62
62
  },
63
63
  "index.tsx": {
64
- "file": "assets/index-CZg-95kd.js",
64
+ "file": "assets/index-DNxu4viw.js",
65
65
  "name": "index",
66
66
  "src": "index.tsx",
67
67
  "isEntry": true,
68
68
  "imports": [
69
- "_vendor-BMWfu6zp.js",
70
- "_vendor-arizeai-Sj74jm5V.js",
71
- "_components-Bhx3QVW0.js",
72
- "_pages-DG-5zgoV.js",
69
+ "_vendor-CIqy43_9.js",
70
+ "_vendor-arizeai-B1YgcWL8.js",
71
+ "_pages-BhOnrUmC.js",
72
+ "_components-DBYPF96c.js",
73
73
  "_vendor-three-DwGkEfCM.js",
74
- "_vendor-codemirror-DO3VqEcD.js",
75
- "_vendor-recharts-BGN0SxgJ.js"
74
+ "_vendor-recharts-C3pM_Wlg.js",
75
+ "_vendor-codemirror-_bcwCA1C.js"
76
76
  ]
77
77
  }
78
78
  }