arize-phoenix 8.3.0__py3-none-any.whl → 8.4.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-8.3.0.dist-info → arize_phoenix-8.4.0.dist-info}/METADATA +2 -1
- {arize_phoenix-8.3.0.dist-info → arize_phoenix-8.4.0.dist-info}/RECORD +22 -21
- phoenix/server/api/context.py +2 -0
- phoenix/server/api/dataloaders/__init__.py +2 -0
- phoenix/server/api/dataloaders/num_child_spans.py +35 -0
- phoenix/server/api/queries.py +72 -3
- phoenix/server/api/types/Span.py +4 -0
- phoenix/server/app.py +2 -0
- phoenix/server/static/.vite/manifest.json +40 -40
- phoenix/server/static/assets/{components-T5K9z49d.js → components-BgFPI6sn.js} +166 -167
- phoenix/server/static/assets/{index-DvHwFF8e.js → index-CIkk8uHr.js} +9 -9
- phoenix/server/static/assets/{pages-CY3ZXSHj.js → pages-CmDiPH1A.js} +603 -585
- phoenix/server/static/assets/{vendor-Cqfydjep.js → vendor-CRRq3WgM.js} +116 -116
- phoenix/server/static/assets/{vendor-arizeai-WnerlUPN.js → vendor-arizeai-Dq64X_0o.js} +1 -1
- phoenix/server/static/assets/{vendor-codemirror-D-ZZKLFq.js → vendor-codemirror-C1oevlym.js} +1 -1
- phoenix/server/static/assets/{vendor-recharts-KY97ZPfK.js → vendor-recharts-CPj01S89.js} +1 -1
- phoenix/server/static/assets/{vendor-shiki-D5K9GnFn.js → vendor-shiki-aY7rz1pm.js} +1 -1
- phoenix/version.py +1 -1
- {arize_phoenix-8.3.0.dist-info → arize_phoenix-8.4.0.dist-info}/WHEEL +0 -0
- {arize_phoenix-8.3.0.dist-info → arize_phoenix-8.4.0.dist-info}/entry_points.txt +0 -0
- {arize_phoenix-8.3.0.dist-info → arize_phoenix-8.4.0.dist-info}/licenses/IP_NOTICE +0 -0
- {arize_phoenix-8.3.0.dist-info → arize_phoenix-8.4.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: arize-phoenix
|
|
3
|
-
Version: 8.
|
|
3
|
+
Version: 8.4.0
|
|
4
4
|
Summary: AI Observability and Evaluation
|
|
5
5
|
Project-URL: Documentation, https://docs.arize.com/phoenix/
|
|
6
6
|
Project-URL: Issues, https://github.com/Arize-ai/phoenix/issues
|
|
@@ -162,6 +162,7 @@ Phoenix is an open-source AI observability platform designed for experimentation
|
|
|
162
162
|
- [**_Datasets_**](https://docs.arize.com/phoenix/datasets-and-experiments/overview-datasets) - Create versioned datasets of examples for experimentation, evaluation, and fine-tuning.
|
|
163
163
|
- [**_Experiments_**](https://docs.arize.com/phoenix/datasets-and-experiments/overview-datasets#experiments) - Track and evaluate changes to prompts, LLMs, and retrieval.
|
|
164
164
|
- [**_Playground_**](https://docs.arize.com/phoenix/prompt-engineering/overview-prompts)- Optimize prompts, compare models, adjust parameters, and replay traced LLM calls.
|
|
165
|
+
- [**_Prompt Mangement_**](https://docs.arize.com/phoenix/prompt-engineering/overview-prompts/prompt-management)- Manage and test prompt changes systematically using version control, tagging, and experimentation.
|
|
165
166
|
|
|
166
167
|
Phoenix is vendor and language agnostic with out-of-the-box support for popular frameworks (🦙[LlamaIndex](https://docs.arize.com/phoenix/tracing/integrations-tracing/llamaindex), 🦜⛓[LangChain](https://docs.arize.com/phoenix/tracing/integrations-tracing/langchain), [Haystack](https://docs.arize.com/phoenix/tracing/integrations-tracing/haystack), 🧩[DSPy](https://docs.arize.com/phoenix/tracing/integrations-tracing/dspy)) and LLM providers ([OpenAI](https://docs.arize.com/phoenix/tracing/integrations-tracing/openai), [Bedrock](https://docs.arize.com/phoenix/tracing/integrations-tracing/bedrock), [MistralAI](https://docs.arize.com/phoenix/tracing/integrations-tracing/mistralai), [VertexAI](https://docs.arize.com/phoenix/tracing/integrations-tracing/vertexai), [LiteLLM](https://docs.arize.com/phoenix/tracing/integrations-tracing/litellm), and more). For details on auto-instrumentation, check out the [OpenInference](https://github.com/Arize-ai/openinference) project.
|
|
167
168
|
|
|
@@ -6,7 +6,7 @@ phoenix/exceptions.py,sha256=n2L2KKuecrdflB9MsCdAYCiSEvGJptIsfRkXMoJle7A,169
|
|
|
6
6
|
phoenix/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
7
7
|
phoenix/services.py,sha256=kpW1WL0kiB8XJsO6XycvZVJ-lBkNoenhQ7atCvBoSe8,5365
|
|
8
8
|
phoenix/settings.py,sha256=ht-0oN-sMV6SPXrk7Tu1EZlngpAYkGNLYPhO8DyrdQI,661
|
|
9
|
-
phoenix/version.py,sha256=
|
|
9
|
+
phoenix/version.py,sha256=ewV4OXfRKUnA7PPA-m0T-EIAUCBmvPUrtesvVXFrkWA,22
|
|
10
10
|
phoenix/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
phoenix/core/embedding_dimension.py,sha256=zKGbcvwOXgLf-yrJBpQyKtd-LEOPRKHnUToyAU8Owis,87
|
|
12
12
|
phoenix/core/model.py,sha256=qBFraOtmwCCnWJltKNP18DDG0mULXigytlFsa6YOz6k,4837
|
|
@@ -80,7 +80,7 @@ phoenix/pointcloud/pointcloud.py,sha256=SN_1wXZcwKrtSnHGZLDZGx71orqE1WyVF7E-D58d
|
|
|
80
80
|
phoenix/pointcloud/projectors.py,sha256=TQgwc9cJDjJkin1WZyZzgl3HsYrLLiyWD7Czy4jNW3U,1088
|
|
81
81
|
phoenix/pointcloud/umap_parameters.py,sha256=db_WEPoamuWtopZx7tQfAXPnoE0MS8FkAV0_ThjEx_Q,1735
|
|
82
82
|
phoenix/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
83
|
-
phoenix/server/app.py,sha256=
|
|
83
|
+
phoenix/server/app.py,sha256=MRy_pDDS0R63Wp8roLCxr_sDe_ZFZJLgwq7-n1mOYTo,39290
|
|
84
84
|
phoenix/server/bearer_auth.py,sha256=0UudvkAS_dxna5JEJJhGUYwB6Ny-e22ssX5Mm79QwCk,5907
|
|
85
85
|
phoenix/server/dml_event.py,sha256=MjJmVEKytq75chBOSyvYDusUnEbg1pHpIjR3pZkUaJA,2838
|
|
86
86
|
phoenix/server/dml_event_handler.py,sha256=EZLXmCvx4pJrCkz29gxwKwmvmUkTtPCHw6klR-XM8qE,8258
|
|
@@ -96,14 +96,14 @@ phoenix/server/types.py,sha256=gJJPBcDRkQ9VHZIt_aLqG_OBbGt1oWp4e3W3Jp61oKs,7409
|
|
|
96
96
|
phoenix/server/api/README.md,sha256=Pyq1PLPgTzXAswrfIhGXrjI3Skq8it2jTVnanT6Ba4Q,1162
|
|
97
97
|
phoenix/server/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
98
98
|
phoenix/server/api/auth.py,sha256=nywpmfMI1trZTbZRD3oBj4kFjzg_vnxDljcM431T1eY,1246
|
|
99
|
-
phoenix/server/api/context.py,sha256=
|
|
99
|
+
phoenix/server/api/context.py,sha256=zeIANzIfUPfs3odkDGvFs6RNRXYmpsz1DJoYlXNR6nM,6375
|
|
100
100
|
phoenix/server/api/exceptions.py,sha256=TA0JuY2YRnj35qGuMSQ8d0ToHum9gWm9W--3fSKHrX0,1171
|
|
101
101
|
phoenix/server/api/interceptor.py,sha256=ykDnoC_apUd-llVli3m1CW18kNSIgjz2qZ6m5JmPDu8,1294
|
|
102
|
-
phoenix/server/api/queries.py,sha256=
|
|
102
|
+
phoenix/server/api/queries.py,sha256=Zygu1nR2Ktkw0-Bc3vnpG5C9LSI_DHRxfujxlOJ7_BU,34542
|
|
103
103
|
phoenix/server/api/schema.py,sha256=fcs36xQwFF_Qe41_5cWR8wYpDvOrnbcyTeo5WNMbDsA,1702
|
|
104
104
|
phoenix/server/api/subscriptions.py,sha256=DSIgQF6lQqkbc7D0AaI5R4g3hIHbU04H5Y2UIpwmpy0,22989
|
|
105
105
|
phoenix/server/api/utils.py,sha256=quCBRcusc6PUq9tJq7M8PgwFZp7nXgVAxtbw8feribY,833
|
|
106
|
-
phoenix/server/api/dataloaders/__init__.py,sha256=
|
|
106
|
+
phoenix/server/api/dataloaders/__init__.py,sha256=ZgJVbqIH-Y4M863fMIOsf4Ka9iVFmWtzqr0a4mQ92BU,4266
|
|
107
107
|
phoenix/server/api/dataloaders/annotation_summaries.py,sha256=2sHmIDX7n8tuPeBTs9bMKtlMKWn_Ph9awTZqmwn2Owc,5505
|
|
108
108
|
phoenix/server/api/dataloaders/average_experiment_run_latency.py,sha256=GLFoFAbztOH-0FVzzZ77mATIO63UcjB50j3qXiNi-tE,1811
|
|
109
109
|
phoenix/server/api/dataloaders/dataset_example_revisions.py,sha256=xF7M2dg3UmjhdCrscnztCIBBI0cg3RF48IIqvilpc18,4623
|
|
@@ -118,6 +118,7 @@ phoenix/server/api/dataloaders/experiment_run_counts.py,sha256=j_7229IL705p_Tycx
|
|
|
118
118
|
phoenix/server/api/dataloaders/experiment_sequence_number.py,sha256=zM_f78fnqhppLtevrx9iISQSN7w_BNeXT9CoX8jYgAI,1534
|
|
119
119
|
phoenix/server/api/dataloaders/latency_ms_quantile.py,sha256=CHWV9nvEEM3xqpXWubywtLtFLzbwyLU85EaP_kQajJU,7363
|
|
120
120
|
phoenix/server/api/dataloaders/min_start_or_max_end_times.py,sha256=1jYglTXv4S8k7OWSGdgeJ2OxVCmZtX8a6sjJp9GPZ04,2783
|
|
121
|
+
phoenix/server/api/dataloaders/num_child_spans.py,sha256=655g9SP_3gfT4qqukfgKzLy5uBLQmnVQBP-mZL3in0s,1200
|
|
121
122
|
phoenix/server/api/dataloaders/project_by_name.py,sha256=O24Rjs0ZQaYtSnPfA6YBQfbHfUgNsHKUcc_gIKyK9vo,1086
|
|
122
123
|
phoenix/server/api/dataloaders/prompt_version_sequence_number.py,sha256=tBaCbpI9KgjCACvpd-5hZy5TDSHH7PJPn4bd1xJuN-g,1314
|
|
123
124
|
phoenix/server/api/dataloaders/record_counts.py,sha256=NLlMEaJ-HxiJavqbSkMbzOrIRzqzYxO8-t2mfp1vXqM,4160
|
|
@@ -277,7 +278,7 @@ phoenix/server/api/types/Retrieval.py,sha256=OhMK2ncjoyp5h1yjKhjlKpoTbQrMHuxmgSF
|
|
|
277
278
|
phoenix/server/api/types/ScalarDriftMetricEnum.py,sha256=IUAcRPpgL41WdoIgK6cNk2Te38SspXGyEs-S1fY23_A,232
|
|
278
279
|
phoenix/server/api/types/Segments.py,sha256=vT2v0efoa5cuBKxLtxTnsUP5YJJCZfTloM71Spu0tMI,2915
|
|
279
280
|
phoenix/server/api/types/SortDir.py,sha256=OUpXhlCzCxPoXSDkJJygEs9Rw9pMymfaZUG5zPTrw4Y,152
|
|
280
|
-
phoenix/server/api/types/Span.py,sha256=
|
|
281
|
+
phoenix/server/api/types/Span.py,sha256=3Neeb1bEc2W2fNyoAfI0ULyb9gtze3Mv6iWHWRFv-Xc,24291
|
|
281
282
|
phoenix/server/api/types/SpanAnnotation.py,sha256=6b5G-b_OoRvDL2ayWk7MkbqarLK-F-pQMx21CpUuNGY,1168
|
|
282
283
|
phoenix/server/api/types/SpanIOValue.py,sha256=c5TWdZZN3v0gHI5xWeY7gjD-sE9ugWlGGAio-gDS-Uo,1653
|
|
283
284
|
phoenix/server/api/types/SystemApiKey.py,sha256=2ym8EgsTBIvxx1l9xZ-2YMovz58ZwYb_MaHBTJ9NH2E,166
|
|
@@ -311,16 +312,16 @@ phoenix/server/static/apple-touch-icon-76x76.png,sha256=CT_xT12I0u2i0WU8JzBZBuOQ
|
|
|
311
312
|
phoenix/server/static/apple-touch-icon.png,sha256=fOfpjqGpWYbJ0eAurKsyoZP1EAs6ZVooBJ_SGk2ZkDs,3801
|
|
312
313
|
phoenix/server/static/favicon.ico,sha256=bY0vvCKRftemZfPShwZtE93DiiQdaYaozkPGwNFr6H8,34494
|
|
313
314
|
phoenix/server/static/modernizr.js,sha256=mvK-XtkNqjOral-QvzoqsyOMECXIMu5BQwSVN_wcU9c,2564
|
|
314
|
-
phoenix/server/static/.vite/manifest.json,sha256=
|
|
315
|
-
phoenix/server/static/assets/components-
|
|
316
|
-
phoenix/server/static/assets/index-
|
|
317
|
-
phoenix/server/static/assets/pages-
|
|
315
|
+
phoenix/server/static/.vite/manifest.json,sha256=E-HVSSr4xC4d_P49I-_9XpFni5j937QU2rPN0G0GDyU,2165
|
|
316
|
+
phoenix/server/static/assets/components-BgFPI6sn.js,sha256=a7Oru901CqeUXNKQ5nUX2qa8qWWrzc6a6Sb_UTCFTPQ,420595
|
|
317
|
+
phoenix/server/static/assets/index-CIkk8uHr.js,sha256=V2MOiWJp1tlJmjxW7QFk5VE-x5coElaXKqVeEPCYSYc,59131
|
|
318
|
+
phoenix/server/static/assets/pages-CmDiPH1A.js,sha256=r1U0ZTva747v8lUvq1-dwBS6aVN_nsKk4xKQmIaTNpU,828439
|
|
319
|
+
phoenix/server/static/assets/vendor-CRRq3WgM.js,sha256=J5mIL57AMCQb5lg2CVj-4e5dGb4NOhDeZNBN61fIROM,2235517
|
|
318
320
|
phoenix/server/static/assets/vendor-Cg6lcjUC.css,sha256=nZrkr0u6NNElFGvpWHk9GTHeGoibCXCli1bE7mXZGZg,1816
|
|
319
|
-
phoenix/server/static/assets/vendor-
|
|
320
|
-
phoenix/server/static/assets/vendor-
|
|
321
|
-
phoenix/server/static/assets/vendor-
|
|
322
|
-
phoenix/server/static/assets/vendor-
|
|
323
|
-
phoenix/server/static/assets/vendor-shiki-D5K9GnFn.js,sha256=mi8NXvOV1AbRuOTVp3wlon_CBUs4RtzqbPjqTD2OnbU,8980312
|
|
321
|
+
phoenix/server/static/assets/vendor-arizeai-Dq64X_0o.js,sha256=jAFsbq-7Q6v08obSM4NW5oMHsouV6Nd9DDV5A9YqsRE,202331
|
|
322
|
+
phoenix/server/static/assets/vendor-codemirror-C1oevlym.js,sha256=UoItJZMSk_7qu0Ru_Pc7AlLDzAIUiX_XE0fSlSXxiWg,393496
|
|
323
|
+
phoenix/server/static/assets/vendor-recharts-CPj01S89.js,sha256=Ko4axsrs0GW5yMWkW6awnBDjtx_s7_jcPYrh-E0gYIU,282095
|
|
324
|
+
phoenix/server/static/assets/vendor-shiki-aY7rz1pm.js,sha256=eC9R-Z5o7yMLGWR-NEvogNGFYv-KlPcUfXnJk7fOWC8,8980312
|
|
324
325
|
phoenix/server/static/assets/vendor-three-C-AGeJYv.js,sha256=c9nLPH5YDRFCzTNuwWO8_5KqcnunPo53mQsb7y9JFW8,620972
|
|
325
326
|
phoenix/server/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
326
327
|
phoenix/server/templates/index.html,sha256=e8_jdi7Eo19SK7DI_gglkTW094D17E0VAegoMmmmvIc,4330
|
|
@@ -361,9 +362,9 @@ phoenix/utilities/project.py,sha256=auVpARXkDb-JgeX5f2aStyFIkeKvGwN9l7qrFeJMVxI,
|
|
|
361
362
|
phoenix/utilities/re.py,sha256=6YyUWIkv0zc2SigsxfOWIHzdpjKA_TZo2iqKq7zJKvw,2081
|
|
362
363
|
phoenix/utilities/span_store.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
363
364
|
phoenix/utilities/template_formatters.py,sha256=gh9PJD6WEGw7TEYXfSst1UR4pWWwmjxMLrDVQ_CkpkQ,2779
|
|
364
|
-
arize_phoenix-8.
|
|
365
|
-
arize_phoenix-8.
|
|
366
|
-
arize_phoenix-8.
|
|
367
|
-
arize_phoenix-8.
|
|
368
|
-
arize_phoenix-8.
|
|
369
|
-
arize_phoenix-8.
|
|
365
|
+
arize_phoenix-8.4.0.dist-info/METADATA,sha256=1rIrOe2Lz0jCoaJ66BH56BqI5E-0Rdm2Zkp8YBx6xaU,23646
|
|
366
|
+
arize_phoenix-8.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
367
|
+
arize_phoenix-8.4.0.dist-info/entry_points.txt,sha256=Pgpn8Upxx9P8z8joPXZWl2LlnAlGc3gcQoVchb06X1Q,94
|
|
368
|
+
arize_phoenix-8.4.0.dist-info/licenses/IP_NOTICE,sha256=JBqyyCYYxGDfzQ0TtsQgjts41IJoa-hiwDrBjCb9gHM,469
|
|
369
|
+
arize_phoenix-8.4.0.dist-info/licenses/LICENSE,sha256=HFkW9REuMOkvKRACuwLPT0hRydHb3zNg-fdFt94td18,3794
|
|
370
|
+
arize_phoenix-8.4.0.dist-info/RECORD,,
|
phoenix/server/api/context.py
CHANGED
|
@@ -29,6 +29,7 @@ from phoenix.server.api.dataloaders import (
|
|
|
29
29
|
ExperimentSequenceNumberDataLoader,
|
|
30
30
|
LatencyMsQuantileDataLoader,
|
|
31
31
|
MinStartOrMaxEndTimeDataLoader,
|
|
32
|
+
NumChildSpansDataLoader,
|
|
32
33
|
ProjectByNameDataLoader,
|
|
33
34
|
PromptVersionSequenceNumberDataLoader,
|
|
34
35
|
RecordCountDataLoader,
|
|
@@ -76,6 +77,7 @@ class DataLoaders:
|
|
|
76
77
|
experiment_sequence_number: ExperimentSequenceNumberDataLoader
|
|
77
78
|
latency_ms_quantile: LatencyMsQuantileDataLoader
|
|
78
79
|
min_start_or_max_end_times: MinStartOrMaxEndTimeDataLoader
|
|
80
|
+
num_child_spans: NumChildSpansDataLoader
|
|
79
81
|
project_fields: TableFieldsDataLoader
|
|
80
82
|
prompt_version_sequence_number: PromptVersionSequenceNumberDataLoader
|
|
81
83
|
record_counts: RecordCountDataLoader
|
|
@@ -17,6 +17,7 @@ from .experiment_run_counts import ExperimentRunCountsDataLoader
|
|
|
17
17
|
from .experiment_sequence_number import ExperimentSequenceNumberDataLoader
|
|
18
18
|
from .latency_ms_quantile import LatencyMsQuantileCache, LatencyMsQuantileDataLoader
|
|
19
19
|
from .min_start_or_max_end_times import MinStartOrMaxEndTimeCache, MinStartOrMaxEndTimeDataLoader
|
|
20
|
+
from .num_child_spans import NumChildSpansDataLoader
|
|
20
21
|
from .project_by_name import ProjectByNameDataLoader
|
|
21
22
|
from .prompt_version_sequence_number import PromptVersionSequenceNumberDataLoader
|
|
22
23
|
from .record_counts import RecordCountCache, RecordCountDataLoader
|
|
@@ -53,6 +54,7 @@ __all__ = [
|
|
|
53
54
|
"ExperimentSequenceNumberDataLoader",
|
|
54
55
|
"LatencyMsQuantileDataLoader",
|
|
55
56
|
"MinStartOrMaxEndTimeDataLoader",
|
|
57
|
+
"NumChildSpansDataLoader",
|
|
56
58
|
"PromptVersionSequenceNumberDataLoader",
|
|
57
59
|
"RecordCountDataLoader",
|
|
58
60
|
"SessionIODataLoader",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from typing import Iterable
|
|
2
|
+
|
|
3
|
+
from sqlalchemy import func, select
|
|
4
|
+
from strawberry.dataloader import DataLoader
|
|
5
|
+
from typing_extensions import TypeAlias
|
|
6
|
+
|
|
7
|
+
from phoenix.db import models
|
|
8
|
+
from phoenix.server.types import DbSessionFactory
|
|
9
|
+
|
|
10
|
+
SpanRowId: TypeAlias = int
|
|
11
|
+
|
|
12
|
+
Key: TypeAlias = SpanRowId
|
|
13
|
+
Result: TypeAlias = int
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class NumChildSpansDataLoader(DataLoader[Key, Result]):
|
|
17
|
+
def __init__(self, db: DbSessionFactory) -> None:
|
|
18
|
+
super().__init__(load_fn=self._load_fn)
|
|
19
|
+
self._db = db
|
|
20
|
+
|
|
21
|
+
async def _load_fn(self, keys: Iterable[Key]) -> list[Result]:
|
|
22
|
+
span_rowids = list(set(keys))
|
|
23
|
+
result: dict[Key, Result] = {}
|
|
24
|
+
children = select(models.Span).alias("children")
|
|
25
|
+
stmt = (
|
|
26
|
+
select(models.Span.id, func.count())
|
|
27
|
+
.where(models.Span.id.in_(span_rowids))
|
|
28
|
+
.join(children, children.c.parent_id == models.Span.span_id)
|
|
29
|
+
.group_by(models.Span.id)
|
|
30
|
+
)
|
|
31
|
+
async with self._db() as session:
|
|
32
|
+
data = await session.stream(stmt)
|
|
33
|
+
async for span_rowid, num_child_spans in data:
|
|
34
|
+
result[span_rowid] = num_child_spans
|
|
35
|
+
return [result.get(span_rowid, 0) for span_rowid in keys]
|
phoenix/server/api/queries.py
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
from collections import defaultdict
|
|
2
2
|
from datetime import datetime
|
|
3
|
-
from typing import Optional, Union
|
|
3
|
+
from typing import Iterable, Iterator, Optional, Union, cast
|
|
4
4
|
|
|
5
5
|
import numpy as np
|
|
6
6
|
import numpy.typing as npt
|
|
7
7
|
import strawberry
|
|
8
|
-
from sqlalchemy import and_, distinct, func, select
|
|
8
|
+
from sqlalchemy import and_, distinct, func, select, text
|
|
9
9
|
from sqlalchemy.orm import joinedload
|
|
10
10
|
from starlette.authentication import UnauthenticatedUser
|
|
11
11
|
from strawberry import ID, UNSET
|
|
12
12
|
from strawberry.relay import Connection, GlobalID, Node
|
|
13
13
|
from strawberry.types import Info
|
|
14
|
-
from typing_extensions import Annotated, TypeAlias
|
|
14
|
+
from typing_extensions import Annotated, TypeAlias, assert_never
|
|
15
15
|
|
|
16
|
+
from phoenix.config import ENV_PHOENIX_SQL_DATABASE_SCHEMA, getenv
|
|
16
17
|
from phoenix.db import enums, models
|
|
18
|
+
from phoenix.db.helpers import SupportedSQLDialect
|
|
17
19
|
from phoenix.db.models import DatasetExample as OrmExample
|
|
18
20
|
from phoenix.db.models import DatasetExampleRevision as OrmRevision
|
|
19
21
|
from phoenix.db.models import DatasetVersion as OrmVersion
|
|
@@ -81,6 +83,12 @@ class ModelsInput:
|
|
|
81
83
|
model_name: Optional[str] = None
|
|
82
84
|
|
|
83
85
|
|
|
86
|
+
@strawberry.type
|
|
87
|
+
class DbTableStats:
|
|
88
|
+
table_name: str
|
|
89
|
+
num_bytes: int
|
|
90
|
+
|
|
91
|
+
|
|
84
92
|
@strawberry.type
|
|
85
93
|
class Query:
|
|
86
94
|
@strawberry.field
|
|
@@ -780,3 +788,64 @@ class Query:
|
|
|
780
788
|
return to_gql_clusters(
|
|
781
789
|
clustered_events=clustered_events,
|
|
782
790
|
)
|
|
791
|
+
|
|
792
|
+
@strawberry.field
|
|
793
|
+
async def db_table_stats(
|
|
794
|
+
self,
|
|
795
|
+
info: Info[Context, None],
|
|
796
|
+
) -> list[DbTableStats]:
|
|
797
|
+
if info.context.db.dialect is SupportedSQLDialect.SQLITE:
|
|
798
|
+
stmt = text("SELECT name, sum(pgsize) FROM dbstat group by name;")
|
|
799
|
+
async with info.context.db() as session:
|
|
800
|
+
stats = cast(Iterable[tuple[str, int]], await session.execute(stmt))
|
|
801
|
+
stats = _consolidate_sqlite_db_table_stats(stats)
|
|
802
|
+
elif info.context.db.dialect is SupportedSQLDialect.POSTGRESQL:
|
|
803
|
+
stmt = text(f"""\
|
|
804
|
+
SELECT c.relname, pg_total_relation_size(c.oid)
|
|
805
|
+
FROM pg_class as c
|
|
806
|
+
INNER JOIN pg_namespace as n ON n.oid = c.relnamespace
|
|
807
|
+
WHERE c.relkind = 'r'
|
|
808
|
+
AND n.nspname = '{getenv(ENV_PHOENIX_SQL_DATABASE_SCHEMA) or "public"}';
|
|
809
|
+
""")
|
|
810
|
+
async with info.context.db() as session:
|
|
811
|
+
stats = cast(Iterable[tuple[str, int]], await session.execute(stmt))
|
|
812
|
+
else:
|
|
813
|
+
assert_never(info.context.db.dialect)
|
|
814
|
+
return [
|
|
815
|
+
DbTableStats(table_name=table_name, num_bytes=num_bytes)
|
|
816
|
+
for table_name, num_bytes in stats
|
|
817
|
+
]
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
def _consolidate_sqlite_db_table_stats(
|
|
821
|
+
stats: Iterable[tuple[str, int]],
|
|
822
|
+
) -> Iterator[tuple[str, int]]:
|
|
823
|
+
"""
|
|
824
|
+
Consolidate SQLite database stats by combining indexes with their respective tables.
|
|
825
|
+
"""
|
|
826
|
+
aggregate: dict[str, int] = {}
|
|
827
|
+
for name, num_bytes in stats:
|
|
828
|
+
# Skip internal SQLite tables and indexes.
|
|
829
|
+
if name.startswith("ix_") or name.startswith("sqlite_"):
|
|
830
|
+
continue
|
|
831
|
+
aggregate[name] = num_bytes
|
|
832
|
+
for name, num_bytes in stats:
|
|
833
|
+
# Combine indexes with their respective tables.
|
|
834
|
+
for flag in ["sqlite_autoindex_", "ix_"]:
|
|
835
|
+
if not name.startswith(flag):
|
|
836
|
+
continue
|
|
837
|
+
if parent := _longest_matching_prefix(name[len(flag) :], aggregate.keys()):
|
|
838
|
+
aggregate[parent] += num_bytes
|
|
839
|
+
break
|
|
840
|
+
yield from aggregate.items()
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
def _longest_matching_prefix(s: str, prefixes: Iterable[str]) -> str:
|
|
844
|
+
"""
|
|
845
|
+
Return the longest prefix of s that matches any of the given prefixes.
|
|
846
|
+
"""
|
|
847
|
+
longest = ""
|
|
848
|
+
for prefix in prefixes:
|
|
849
|
+
if s.startswith(prefix) and len(prefix) > len(longest):
|
|
850
|
+
longest = prefix
|
|
851
|
+
return longest
|
phoenix/server/api/types/Span.py
CHANGED
|
@@ -537,6 +537,10 @@ class Span(Node):
|
|
|
537
537
|
(self.span_rowid, evaluation_name or None, num_documents),
|
|
538
538
|
)
|
|
539
539
|
|
|
540
|
+
@strawberry.field
|
|
541
|
+
async def num_child_spans(self, info: Info[Context, None]) -> int:
|
|
542
|
+
return await info.context.data_loaders.num_child_spans.load(self.span_rowid)
|
|
543
|
+
|
|
540
544
|
@strawberry.field(
|
|
541
545
|
description="All descendant spans (children, grandchildren, etc.)",
|
|
542
546
|
) # type: ignore
|
phoenix/server/app.py
CHANGED
|
@@ -85,6 +85,7 @@ from phoenix.server.api.dataloaders import (
|
|
|
85
85
|
ExperimentSequenceNumberDataLoader,
|
|
86
86
|
LatencyMsQuantileDataLoader,
|
|
87
87
|
MinStartOrMaxEndTimeDataLoader,
|
|
88
|
+
NumChildSpansDataLoader,
|
|
88
89
|
ProjectByNameDataLoader,
|
|
89
90
|
PromptVersionSequenceNumberDataLoader,
|
|
90
91
|
RecordCountDataLoader,
|
|
@@ -614,6 +615,7 @@ def create_graphql_router(
|
|
|
614
615
|
else None
|
|
615
616
|
),
|
|
616
617
|
),
|
|
618
|
+
num_child_spans=NumChildSpansDataLoader(db),
|
|
617
619
|
project_fields=TableFieldsDataLoader(db, models.Project),
|
|
618
620
|
prompt_version_sequence_number=PromptVersionSequenceNumberDataLoader(db),
|
|
619
621
|
record_counts=RecordCountDataLoader(
|
|
@@ -1,32 +1,28 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_components-
|
|
3
|
-
"file": "assets/components-
|
|
2
|
+
"_components-BgFPI6sn.js": {
|
|
3
|
+
"file": "assets/components-BgFPI6sn.js",
|
|
4
4
|
"name": "components",
|
|
5
5
|
"imports": [
|
|
6
|
-
"_vendor-
|
|
7
|
-
"_pages-
|
|
8
|
-
"_vendor-arizeai-
|
|
9
|
-
"_vendor-codemirror-
|
|
6
|
+
"_vendor-CRRq3WgM.js",
|
|
7
|
+
"_pages-CmDiPH1A.js",
|
|
8
|
+
"_vendor-arizeai-Dq64X_0o.js",
|
|
9
|
+
"_vendor-codemirror-C1oevlym.js",
|
|
10
10
|
"_vendor-three-C-AGeJYv.js"
|
|
11
11
|
]
|
|
12
12
|
},
|
|
13
|
-
"_pages-
|
|
14
|
-
"file": "assets/pages-
|
|
13
|
+
"_pages-CmDiPH1A.js": {
|
|
14
|
+
"file": "assets/pages-CmDiPH1A.js",
|
|
15
15
|
"name": "pages",
|
|
16
16
|
"imports": [
|
|
17
|
-
"_vendor-
|
|
18
|
-
"_vendor-arizeai-
|
|
19
|
-
"_components-
|
|
20
|
-
"_vendor-codemirror-
|
|
21
|
-
"_vendor-recharts-
|
|
17
|
+
"_vendor-CRRq3WgM.js",
|
|
18
|
+
"_vendor-arizeai-Dq64X_0o.js",
|
|
19
|
+
"_components-BgFPI6sn.js",
|
|
20
|
+
"_vendor-codemirror-C1oevlym.js",
|
|
21
|
+
"_vendor-recharts-CPj01S89.js"
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
|
-
"_vendor-
|
|
25
|
-
"file": "assets/vendor-
|
|
26
|
-
"src": "_vendor-Cg6lcjUC.css"
|
|
27
|
-
},
|
|
28
|
-
"_vendor-Cqfydjep.js": {
|
|
29
|
-
"file": "assets/vendor-Cqfydjep.js",
|
|
24
|
+
"_vendor-CRRq3WgM.js": {
|
|
25
|
+
"file": "assets/vendor-CRRq3WgM.js",
|
|
30
26
|
"name": "vendor",
|
|
31
27
|
"imports": [
|
|
32
28
|
"_vendor-three-C-AGeJYv.js"
|
|
@@ -35,33 +31,37 @@
|
|
|
35
31
|
"assets/vendor-Cg6lcjUC.css"
|
|
36
32
|
]
|
|
37
33
|
},
|
|
38
|
-
"_vendor-
|
|
39
|
-
"file": "assets/vendor-
|
|
34
|
+
"_vendor-Cg6lcjUC.css": {
|
|
35
|
+
"file": "assets/vendor-Cg6lcjUC.css",
|
|
36
|
+
"src": "_vendor-Cg6lcjUC.css"
|
|
37
|
+
},
|
|
38
|
+
"_vendor-arizeai-Dq64X_0o.js": {
|
|
39
|
+
"file": "assets/vendor-arizeai-Dq64X_0o.js",
|
|
40
40
|
"name": "vendor-arizeai",
|
|
41
41
|
"imports": [
|
|
42
|
-
"_vendor-
|
|
42
|
+
"_vendor-CRRq3WgM.js"
|
|
43
43
|
]
|
|
44
44
|
},
|
|
45
|
-
"_vendor-codemirror-
|
|
46
|
-
"file": "assets/vendor-codemirror-
|
|
45
|
+
"_vendor-codemirror-C1oevlym.js": {
|
|
46
|
+
"file": "assets/vendor-codemirror-C1oevlym.js",
|
|
47
47
|
"name": "vendor-codemirror",
|
|
48
48
|
"imports": [
|
|
49
|
-
"_vendor-
|
|
50
|
-
"_vendor-shiki-
|
|
49
|
+
"_vendor-CRRq3WgM.js",
|
|
50
|
+
"_vendor-shiki-aY7rz1pm.js"
|
|
51
51
|
]
|
|
52
52
|
},
|
|
53
|
-
"_vendor-recharts-
|
|
54
|
-
"file": "assets/vendor-recharts-
|
|
53
|
+
"_vendor-recharts-CPj01S89.js": {
|
|
54
|
+
"file": "assets/vendor-recharts-CPj01S89.js",
|
|
55
55
|
"name": "vendor-recharts",
|
|
56
56
|
"imports": [
|
|
57
|
-
"_vendor-
|
|
57
|
+
"_vendor-CRRq3WgM.js"
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
|
-
"_vendor-shiki-
|
|
61
|
-
"file": "assets/vendor-shiki-
|
|
60
|
+
"_vendor-shiki-aY7rz1pm.js": {
|
|
61
|
+
"file": "assets/vendor-shiki-aY7rz1pm.js",
|
|
62
62
|
"name": "vendor-shiki",
|
|
63
63
|
"imports": [
|
|
64
|
-
"_vendor-
|
|
64
|
+
"_vendor-CRRq3WgM.js"
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"_vendor-three-C-AGeJYv.js": {
|
|
@@ -69,19 +69,19 @@
|
|
|
69
69
|
"name": "vendor-three"
|
|
70
70
|
},
|
|
71
71
|
"index.tsx": {
|
|
72
|
-
"file": "assets/index-
|
|
72
|
+
"file": "assets/index-CIkk8uHr.js",
|
|
73
73
|
"name": "index",
|
|
74
74
|
"src": "index.tsx",
|
|
75
75
|
"isEntry": true,
|
|
76
76
|
"imports": [
|
|
77
|
-
"_vendor-
|
|
78
|
-
"_vendor-arizeai-
|
|
79
|
-
"_pages-
|
|
80
|
-
"_components-
|
|
77
|
+
"_vendor-CRRq3WgM.js",
|
|
78
|
+
"_vendor-arizeai-Dq64X_0o.js",
|
|
79
|
+
"_pages-CmDiPH1A.js",
|
|
80
|
+
"_components-BgFPI6sn.js",
|
|
81
81
|
"_vendor-three-C-AGeJYv.js",
|
|
82
|
-
"_vendor-codemirror-
|
|
83
|
-
"_vendor-shiki-
|
|
84
|
-
"_vendor-recharts-
|
|
82
|
+
"_vendor-codemirror-C1oevlym.js",
|
|
83
|
+
"_vendor-shiki-aY7rz1pm.js",
|
|
84
|
+
"_vendor-recharts-CPj01S89.js"
|
|
85
85
|
]
|
|
86
86
|
}
|
|
87
87
|
}
|