arize-phoenix 10.0.4__py3-none-any.whl → 12.28.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. {arize_phoenix-10.0.4.dist-info → arize_phoenix-12.28.1.dist-info}/METADATA +124 -72
  2. arize_phoenix-12.28.1.dist-info/RECORD +499 -0
  3. {arize_phoenix-10.0.4.dist-info → arize_phoenix-12.28.1.dist-info}/WHEEL +1 -1
  4. {arize_phoenix-10.0.4.dist-info → arize_phoenix-12.28.1.dist-info}/licenses/IP_NOTICE +1 -1
  5. phoenix/__generated__/__init__.py +0 -0
  6. phoenix/__generated__/classification_evaluator_configs/__init__.py +20 -0
  7. phoenix/__generated__/classification_evaluator_configs/_document_relevance_classification_evaluator_config.py +17 -0
  8. phoenix/__generated__/classification_evaluator_configs/_hallucination_classification_evaluator_config.py +17 -0
  9. phoenix/__generated__/classification_evaluator_configs/_models.py +18 -0
  10. phoenix/__generated__/classification_evaluator_configs/_tool_selection_classification_evaluator_config.py +17 -0
  11. phoenix/__init__.py +5 -4
  12. phoenix/auth.py +39 -2
  13. phoenix/config.py +1763 -91
  14. phoenix/datetime_utils.py +120 -2
  15. phoenix/db/README.md +595 -25
  16. phoenix/db/bulk_inserter.py +145 -103
  17. phoenix/db/engines.py +140 -33
  18. phoenix/db/enums.py +3 -12
  19. phoenix/db/facilitator.py +302 -35
  20. phoenix/db/helpers.py +1000 -65
  21. phoenix/db/iam_auth.py +64 -0
  22. phoenix/db/insertion/dataset.py +135 -2
  23. phoenix/db/insertion/document_annotation.py +9 -6
  24. phoenix/db/insertion/evaluation.py +2 -3
  25. phoenix/db/insertion/helpers.py +17 -2
  26. phoenix/db/insertion/session_annotation.py +176 -0
  27. phoenix/db/insertion/span.py +15 -11
  28. phoenix/db/insertion/span_annotation.py +3 -4
  29. phoenix/db/insertion/trace_annotation.py +3 -4
  30. phoenix/db/insertion/types.py +50 -20
  31. phoenix/db/migrations/versions/01a8342c9cdf_add_user_id_on_datasets.py +40 -0
  32. phoenix/db/migrations/versions/0df286449799_add_session_annotations_table.py +105 -0
  33. phoenix/db/migrations/versions/272b66ff50f8_drop_single_indices.py +119 -0
  34. phoenix/db/migrations/versions/58228d933c91_dataset_labels.py +67 -0
  35. phoenix/db/migrations/versions/699f655af132_experiment_tags.py +57 -0
  36. phoenix/db/migrations/versions/735d3d93c33e_add_composite_indices.py +41 -0
  37. phoenix/db/migrations/versions/a20694b15f82_cost.py +196 -0
  38. phoenix/db/migrations/versions/ab513d89518b_add_user_id_on_dataset_versions.py +40 -0
  39. phoenix/db/migrations/versions/d0690a79ea51_users_on_experiments.py +40 -0
  40. phoenix/db/migrations/versions/deb2c81c0bb2_dataset_splits.py +139 -0
  41. phoenix/db/migrations/versions/e76cbd66ffc3_add_experiments_dataset_examples.py +87 -0
  42. phoenix/db/models.py +669 -56
  43. phoenix/db/pg_config.py +10 -0
  44. phoenix/db/types/model_provider.py +4 -0
  45. phoenix/db/types/token_price_customization.py +29 -0
  46. phoenix/db/types/trace_retention.py +23 -15
  47. phoenix/experiments/evaluators/utils.py +3 -3
  48. phoenix/experiments/functions.py +160 -52
  49. phoenix/experiments/tracing.py +2 -2
  50. phoenix/experiments/types.py +1 -1
  51. phoenix/inferences/inferences.py +1 -2
  52. phoenix/server/api/auth.py +38 -7
  53. phoenix/server/api/auth_messages.py +46 -0
  54. phoenix/server/api/context.py +100 -4
  55. phoenix/server/api/dataloaders/__init__.py +79 -5
  56. phoenix/server/api/dataloaders/annotation_configs_by_project.py +31 -0
  57. phoenix/server/api/dataloaders/annotation_summaries.py +60 -8
  58. phoenix/server/api/dataloaders/average_experiment_repeated_run_group_latency.py +50 -0
  59. phoenix/server/api/dataloaders/average_experiment_run_latency.py +17 -24
  60. phoenix/server/api/dataloaders/cache/two_tier_cache.py +1 -2
  61. phoenix/server/api/dataloaders/dataset_dataset_splits.py +52 -0
  62. phoenix/server/api/dataloaders/dataset_example_revisions.py +0 -1
  63. phoenix/server/api/dataloaders/dataset_example_splits.py +40 -0
  64. phoenix/server/api/dataloaders/dataset_examples_and_versions_by_experiment_run.py +47 -0
  65. phoenix/server/api/dataloaders/dataset_labels.py +36 -0
  66. phoenix/server/api/dataloaders/document_evaluation_summaries.py +2 -2
  67. phoenix/server/api/dataloaders/document_evaluations.py +6 -9
  68. phoenix/server/api/dataloaders/experiment_annotation_summaries.py +88 -34
  69. phoenix/server/api/dataloaders/experiment_dataset_splits.py +43 -0
  70. phoenix/server/api/dataloaders/experiment_error_rates.py +21 -28
  71. phoenix/server/api/dataloaders/experiment_repeated_run_group_annotation_summaries.py +77 -0
  72. phoenix/server/api/dataloaders/experiment_repeated_run_groups.py +57 -0
  73. phoenix/server/api/dataloaders/experiment_runs_by_experiment_and_example.py +44 -0
  74. phoenix/server/api/dataloaders/last_used_times_by_generative_model_id.py +35 -0
  75. phoenix/server/api/dataloaders/latency_ms_quantile.py +40 -8
  76. phoenix/server/api/dataloaders/record_counts.py +37 -10
  77. phoenix/server/api/dataloaders/session_annotations_by_session.py +29 -0
  78. phoenix/server/api/dataloaders/span_cost_by_span.py +24 -0
  79. phoenix/server/api/dataloaders/span_cost_detail_summary_entries_by_generative_model.py +56 -0
  80. phoenix/server/api/dataloaders/span_cost_detail_summary_entries_by_project_session.py +57 -0
  81. phoenix/server/api/dataloaders/span_cost_detail_summary_entries_by_span.py +43 -0
  82. phoenix/server/api/dataloaders/span_cost_detail_summary_entries_by_trace.py +56 -0
  83. phoenix/server/api/dataloaders/span_cost_details_by_span_cost.py +27 -0
  84. phoenix/server/api/dataloaders/span_cost_summary_by_experiment.py +57 -0
  85. phoenix/server/api/dataloaders/span_cost_summary_by_experiment_repeated_run_group.py +64 -0
  86. phoenix/server/api/dataloaders/span_cost_summary_by_experiment_run.py +58 -0
  87. phoenix/server/api/dataloaders/span_cost_summary_by_generative_model.py +55 -0
  88. phoenix/server/api/dataloaders/span_cost_summary_by_project.py +152 -0
  89. phoenix/server/api/dataloaders/span_cost_summary_by_project_session.py +56 -0
  90. phoenix/server/api/dataloaders/span_cost_summary_by_trace.py +55 -0
  91. phoenix/server/api/dataloaders/span_costs.py +29 -0
  92. phoenix/server/api/dataloaders/table_fields.py +2 -2
  93. phoenix/server/api/dataloaders/token_prices_by_model.py +30 -0
  94. phoenix/server/api/dataloaders/trace_annotations_by_trace.py +27 -0
  95. phoenix/server/api/dataloaders/types.py +29 -0
  96. phoenix/server/api/exceptions.py +11 -1
  97. phoenix/server/api/helpers/dataset_helpers.py +5 -1
  98. phoenix/server/api/helpers/playground_clients.py +1243 -292
  99. phoenix/server/api/helpers/playground_registry.py +2 -2
  100. phoenix/server/api/helpers/playground_spans.py +8 -4
  101. phoenix/server/api/helpers/playground_users.py +26 -0
  102. phoenix/server/api/helpers/prompts/conversions/aws.py +83 -0
  103. phoenix/server/api/helpers/prompts/conversions/google.py +103 -0
  104. phoenix/server/api/helpers/prompts/models.py +205 -22
  105. phoenix/server/api/input_types/{SpanAnnotationFilter.py → AnnotationFilter.py} +22 -14
  106. phoenix/server/api/input_types/ChatCompletionInput.py +6 -2
  107. phoenix/server/api/input_types/CreateProjectInput.py +27 -0
  108. phoenix/server/api/input_types/CreateProjectSessionAnnotationInput.py +37 -0
  109. phoenix/server/api/input_types/DatasetFilter.py +17 -0
  110. phoenix/server/api/input_types/ExperimentRunSort.py +237 -0
  111. phoenix/server/api/input_types/GenerativeCredentialInput.py +9 -0
  112. phoenix/server/api/input_types/GenerativeModelInput.py +5 -0
  113. phoenix/server/api/input_types/ProjectSessionSort.py +161 -1
  114. phoenix/server/api/input_types/PromptFilter.py +14 -0
  115. phoenix/server/api/input_types/PromptVersionInput.py +52 -1
  116. phoenix/server/api/input_types/SpanSort.py +44 -7
  117. phoenix/server/api/input_types/TimeBinConfig.py +23 -0
  118. phoenix/server/api/input_types/UpdateAnnotationInput.py +34 -0
  119. phoenix/server/api/input_types/UserRoleInput.py +1 -0
  120. phoenix/server/api/mutations/__init__.py +10 -0
  121. phoenix/server/api/mutations/annotation_config_mutations.py +8 -8
  122. phoenix/server/api/mutations/api_key_mutations.py +19 -23
  123. phoenix/server/api/mutations/chat_mutations.py +154 -47
  124. phoenix/server/api/mutations/dataset_label_mutations.py +243 -0
  125. phoenix/server/api/mutations/dataset_mutations.py +21 -16
  126. phoenix/server/api/mutations/dataset_split_mutations.py +351 -0
  127. phoenix/server/api/mutations/experiment_mutations.py +2 -2
  128. phoenix/server/api/mutations/export_events_mutations.py +3 -3
  129. phoenix/server/api/mutations/model_mutations.py +210 -0
  130. phoenix/server/api/mutations/project_mutations.py +49 -10
  131. phoenix/server/api/mutations/project_session_annotations_mutations.py +158 -0
  132. phoenix/server/api/mutations/project_trace_retention_policy_mutations.py +8 -4
  133. phoenix/server/api/mutations/prompt_label_mutations.py +74 -65
  134. phoenix/server/api/mutations/prompt_mutations.py +65 -129
  135. phoenix/server/api/mutations/prompt_version_tag_mutations.py +11 -8
  136. phoenix/server/api/mutations/span_annotations_mutations.py +15 -10
  137. phoenix/server/api/mutations/trace_annotations_mutations.py +14 -10
  138. phoenix/server/api/mutations/trace_mutations.py +47 -3
  139. phoenix/server/api/mutations/user_mutations.py +66 -41
  140. phoenix/server/api/queries.py +768 -293
  141. phoenix/server/api/routers/__init__.py +2 -2
  142. phoenix/server/api/routers/auth.py +154 -88
  143. phoenix/server/api/routers/ldap.py +229 -0
  144. phoenix/server/api/routers/oauth2.py +369 -106
  145. phoenix/server/api/routers/v1/__init__.py +24 -4
  146. phoenix/server/api/routers/v1/annotation_configs.py +23 -31
  147. phoenix/server/api/routers/v1/annotations.py +481 -17
  148. phoenix/server/api/routers/v1/datasets.py +395 -81
  149. phoenix/server/api/routers/v1/documents.py +142 -0
  150. phoenix/server/api/routers/v1/evaluations.py +24 -31
  151. phoenix/server/api/routers/v1/experiment_evaluations.py +19 -8
  152. phoenix/server/api/routers/v1/experiment_runs.py +337 -59
  153. phoenix/server/api/routers/v1/experiments.py +479 -48
  154. phoenix/server/api/routers/v1/models.py +7 -0
  155. phoenix/server/api/routers/v1/projects.py +18 -49
  156. phoenix/server/api/routers/v1/prompts.py +54 -40
  157. phoenix/server/api/routers/v1/sessions.py +108 -0
  158. phoenix/server/api/routers/v1/spans.py +1091 -81
  159. phoenix/server/api/routers/v1/traces.py +132 -78
  160. phoenix/server/api/routers/v1/users.py +389 -0
  161. phoenix/server/api/routers/v1/utils.py +3 -7
  162. phoenix/server/api/subscriptions.py +305 -88
  163. phoenix/server/api/types/Annotation.py +90 -23
  164. phoenix/server/api/types/ApiKey.py +13 -17
  165. phoenix/server/api/types/AuthMethod.py +1 -0
  166. phoenix/server/api/types/ChatCompletionSubscriptionPayload.py +1 -0
  167. phoenix/server/api/types/CostBreakdown.py +12 -0
  168. phoenix/server/api/types/Dataset.py +226 -72
  169. phoenix/server/api/types/DatasetExample.py +88 -18
  170. phoenix/server/api/types/DatasetExperimentAnnotationSummary.py +10 -0
  171. phoenix/server/api/types/DatasetLabel.py +57 -0
  172. phoenix/server/api/types/DatasetSplit.py +98 -0
  173. phoenix/server/api/types/DatasetVersion.py +49 -4
  174. phoenix/server/api/types/DocumentAnnotation.py +212 -0
  175. phoenix/server/api/types/Experiment.py +264 -59
  176. phoenix/server/api/types/ExperimentComparison.py +5 -10
  177. phoenix/server/api/types/ExperimentRepeatedRunGroup.py +155 -0
  178. phoenix/server/api/types/ExperimentRepeatedRunGroupAnnotationSummary.py +9 -0
  179. phoenix/server/api/types/ExperimentRun.py +169 -65
  180. phoenix/server/api/types/ExperimentRunAnnotation.py +158 -39
  181. phoenix/server/api/types/GenerativeModel.py +245 -3
  182. phoenix/server/api/types/GenerativeProvider.py +70 -11
  183. phoenix/server/api/types/{Model.py → InferenceModel.py} +1 -1
  184. phoenix/server/api/types/ModelInterface.py +16 -0
  185. phoenix/server/api/types/PlaygroundModel.py +20 -0
  186. phoenix/server/api/types/Project.py +1278 -216
  187. phoenix/server/api/types/ProjectSession.py +188 -28
  188. phoenix/server/api/types/ProjectSessionAnnotation.py +187 -0
  189. phoenix/server/api/types/ProjectTraceRetentionPolicy.py +1 -1
  190. phoenix/server/api/types/Prompt.py +119 -39
  191. phoenix/server/api/types/PromptLabel.py +42 -25
  192. phoenix/server/api/types/PromptVersion.py +11 -8
  193. phoenix/server/api/types/PromptVersionTag.py +65 -25
  194. phoenix/server/api/types/ServerStatus.py +6 -0
  195. phoenix/server/api/types/Span.py +167 -123
  196. phoenix/server/api/types/SpanAnnotation.py +189 -42
  197. phoenix/server/api/types/SpanCostDetailSummaryEntry.py +10 -0
  198. phoenix/server/api/types/SpanCostSummary.py +10 -0
  199. phoenix/server/api/types/SystemApiKey.py +65 -1
  200. phoenix/server/api/types/TokenPrice.py +16 -0
  201. phoenix/server/api/types/TokenUsage.py +3 -3
  202. phoenix/server/api/types/Trace.py +223 -51
  203. phoenix/server/api/types/TraceAnnotation.py +149 -50
  204. phoenix/server/api/types/User.py +137 -32
  205. phoenix/server/api/types/UserApiKey.py +73 -26
  206. phoenix/server/api/types/node.py +10 -0
  207. phoenix/server/api/types/pagination.py +11 -2
  208. phoenix/server/app.py +290 -45
  209. phoenix/server/authorization.py +38 -3
  210. phoenix/server/bearer_auth.py +34 -24
  211. phoenix/server/cost_tracking/cost_details_calculator.py +196 -0
  212. phoenix/server/cost_tracking/cost_model_lookup.py +179 -0
  213. phoenix/server/cost_tracking/helpers.py +68 -0
  214. phoenix/server/cost_tracking/model_cost_manifest.json +3657 -830
  215. phoenix/server/cost_tracking/regex_specificity.py +397 -0
  216. phoenix/server/cost_tracking/token_cost_calculator.py +57 -0
  217. phoenix/server/daemons/__init__.py +0 -0
  218. phoenix/server/daemons/db_disk_usage_monitor.py +214 -0
  219. phoenix/server/daemons/generative_model_store.py +103 -0
  220. phoenix/server/daemons/span_cost_calculator.py +99 -0
  221. phoenix/server/dml_event.py +17 -0
  222. phoenix/server/dml_event_handler.py +5 -0
  223. phoenix/server/email/sender.py +56 -3
  224. phoenix/server/email/templates/db_disk_usage_notification.html +19 -0
  225. phoenix/server/email/types.py +11 -0
  226. phoenix/server/experiments/__init__.py +0 -0
  227. phoenix/server/experiments/utils.py +14 -0
  228. phoenix/server/grpc_server.py +11 -11
  229. phoenix/server/jwt_store.py +17 -15
  230. phoenix/server/ldap.py +1449 -0
  231. phoenix/server/main.py +26 -10
  232. phoenix/server/oauth2.py +330 -12
  233. phoenix/server/prometheus.py +66 -6
  234. phoenix/server/rate_limiters.py +4 -9
  235. phoenix/server/retention.py +33 -20
  236. phoenix/server/session_filters.py +49 -0
  237. phoenix/server/static/.vite/manifest.json +55 -51
  238. phoenix/server/static/assets/components-BreFUQQa.js +6702 -0
  239. phoenix/server/static/assets/{index-E0M82BdE.js → index-CTQoemZv.js} +140 -56
  240. phoenix/server/static/assets/pages-DBE5iYM3.js +9524 -0
  241. phoenix/server/static/assets/vendor-BGzfc4EU.css +1 -0
  242. phoenix/server/static/assets/vendor-DCE4v-Ot.js +920 -0
  243. phoenix/server/static/assets/vendor-codemirror-D5f205eT.js +25 -0
  244. phoenix/server/static/assets/vendor-recharts-V9cwpXsm.js +37 -0
  245. phoenix/server/static/assets/vendor-shiki-Do--csgv.js +5 -0
  246. phoenix/server/static/assets/vendor-three-CmB8bl_y.js +3840 -0
  247. phoenix/server/templates/index.html +40 -6
  248. phoenix/server/thread_server.py +1 -2
  249. phoenix/server/types.py +14 -4
  250. phoenix/server/utils.py +74 -0
  251. phoenix/session/client.py +56 -3
  252. phoenix/session/data_extractor.py +5 -0
  253. phoenix/session/evaluation.py +14 -5
  254. phoenix/session/session.py +45 -9
  255. phoenix/settings.py +5 -0
  256. phoenix/trace/attributes.py +80 -13
  257. phoenix/trace/dsl/helpers.py +90 -1
  258. phoenix/trace/dsl/query.py +8 -6
  259. phoenix/trace/projects.py +5 -0
  260. phoenix/utilities/template_formatters.py +1 -1
  261. phoenix/version.py +1 -1
  262. arize_phoenix-10.0.4.dist-info/RECORD +0 -405
  263. phoenix/server/api/types/Evaluation.py +0 -39
  264. phoenix/server/cost_tracking/cost_lookup.py +0 -255
  265. phoenix/server/static/assets/components-DULKeDfL.js +0 -4365
  266. phoenix/server/static/assets/pages-Cl0A-0U2.js +0 -7430
  267. phoenix/server/static/assets/vendor-WIZid84E.css +0 -1
  268. phoenix/server/static/assets/vendor-arizeai-Dy-0mSNw.js +0 -649
  269. phoenix/server/static/assets/vendor-codemirror-DBtifKNr.js +0 -33
  270. phoenix/server/static/assets/vendor-oB4u9zuV.js +0 -905
  271. phoenix/server/static/assets/vendor-recharts-D-T4KPz2.js +0 -59
  272. phoenix/server/static/assets/vendor-shiki-BMn4O_9F.js +0 -5
  273. phoenix/server/static/assets/vendor-three-C5WAXd5r.js +0 -2998
  274. phoenix/utilities/deprecation.py +0 -31
  275. {arize_phoenix-10.0.4.dist-info → arize_phoenix-12.28.1.dist-info}/entry_points.txt +0 -0
  276. {arize_phoenix-10.0.4.dist-info → arize_phoenix-12.28.1.dist-info}/licenses/LICENSE +0 -0
phoenix/db/README.md CHANGED
@@ -64,11 +64,11 @@ erDiagram
64
64
  int id PK
65
65
  string name
66
66
  string cron_expression
67
- json rule
67
+ jsonb rule
68
68
  }
69
69
 
70
70
  Project ||--o{ Trace : has
71
- Project ||--o| ProjectTraceRetentionPolicy : has
71
+ Project ||--o{ ProjectSession : has
72
72
  Project ||--o{ ProjectAnnotationConfig : has
73
73
  Project {
74
74
  int id PK
@@ -82,6 +82,7 @@ erDiagram
82
82
  }
83
83
 
84
84
  ProjectSession ||--o{ Trace : has
85
+ ProjectSession ||--o{ ProjectSessionAnnotation : has
85
86
  ProjectSession {
86
87
  int id PK
87
88
  string session_id
@@ -115,8 +116,8 @@ erDiagram
115
116
  string span_kind
116
117
  datetime start_time
117
118
  datetime end_time
118
- json attributes
119
- json events
119
+ jsonb attributes
120
+ jsonb events
120
121
  string status_code
121
122
  string status_message
122
123
  int cumulative_error_count
@@ -132,9 +133,9 @@ erDiagram
132
133
  int document_position
133
134
  string name
134
135
  string label
135
- float score
136
+ double score
136
137
  string explanation
137
- json metadata
138
+ jsonb metadata
138
139
  string annotator_kind
139
140
  datetime created_at
140
141
  datetime updated_at
@@ -148,9 +149,9 @@ erDiagram
148
149
  int span_rowid FK
149
150
  string name
150
151
  string label
151
- float score
152
+ double score
152
153
  string explanation
153
- json metadata
154
+ jsonb metadata
154
155
  string annotator_kind
155
156
  datetime created_at
156
157
  datetime updated_at
@@ -164,9 +165,9 @@ erDiagram
164
165
  int trace_rowid FK
165
166
  string name
166
167
  string label
167
- float score
168
+ double score
168
169
  string explanation
169
- json metadata
170
+ jsonb metadata
170
171
  string annotator_kind
171
172
  datetime created_at
172
173
  datetime updated_at
@@ -177,25 +178,33 @@ erDiagram
177
178
 
178
179
  Dataset ||--o{ DatasetVersion : has
179
180
  Dataset ||--o{ DatasetExample : contains
181
+ Dataset ||--o{ Experiment : used_in
182
+ Dataset ||--o{ DatasetsDatasetLabel : has
183
+ Dataset ||--o{ ExperimentTag : tagged_with
180
184
  Dataset {
181
185
  int id PK
182
186
  string name
183
187
  string description
184
- json metadata
188
+ jsonb metadata
185
189
  datetime created_at
186
190
  datetime updated_at
191
+ bigint user_id FK
187
192
  }
188
193
 
189
194
  DatasetVersion ||--o{ DatasetExampleRevision : has
195
+ DatasetVersion ||--o{ Experiment : used_in
190
196
  DatasetVersion {
191
197
  int id PK
192
198
  int dataset_id FK
193
199
  string description
194
- json metadata
200
+ jsonb metadata
195
201
  datetime created_at
202
+ bigint user_id FK
196
203
  }
197
204
 
198
205
  DatasetExample ||--o{ DatasetExampleRevision : has
206
+ DatasetExample ||--o{ DatasetSplitsDatasetExample : belongs_to
207
+ DatasetExample ||--o{ ExperimentsDatasetExample : linked_in
199
208
  DatasetExample {
200
209
  int id PK
201
210
  int dataset_id FK
@@ -203,18 +212,22 @@ erDiagram
203
212
  datetime created_at
204
213
  }
205
214
 
215
+ DatasetExampleRevision ||--o{ ExperimentsDatasetExample : revision_used
206
216
  DatasetExampleRevision {
207
217
  int id PK
208
218
  int dataset_example_id FK
209
219
  int dataset_version_id FK
210
- json input
211
- json output
212
- json metadata
220
+ jsonb input
221
+ jsonb output
222
+ jsonb metadata
213
223
  string revision_kind
214
224
  datetime created_at
215
225
  }
216
226
 
217
227
  Experiment ||--o{ ExperimentRun : has
228
+ Experiment ||--o{ ExperimentTag : has
229
+ Experiment ||--o{ ExperimentsDatasetExample : includes
230
+ Experiment ||--o{ ExperimentsDatasetSplit : uses
218
231
  Experiment {
219
232
  int id PK
220
233
  int dataset_id FK
@@ -222,20 +235,22 @@ erDiagram
222
235
  string name
223
236
  string description
224
237
  int repetitions
225
- json metadata
238
+ jsonb metadata
226
239
  string project_name
227
240
  datetime created_at
228
241
  datetime updated_at
242
+ int user_id FK
229
243
  }
230
244
 
231
245
  ExperimentRun ||--o{ ExperimentRunAnnotation : has
246
+ DatasetExample ||--o{ ExperimentRun : used_in
232
247
  ExperimentRun {
233
248
  int id PK
234
249
  int experiment_id FK
235
250
  int dataset_example_id FK
236
251
  int repetition_number
237
252
  string trace_id
238
- json output
253
+ jsonb output
239
254
  datetime start_time
240
255
  datetime end_time
241
256
  int prompt_token_count
@@ -249,15 +264,84 @@ erDiagram
249
264
  string name
250
265
  string annotator_kind
251
266
  string label
252
- float score
267
+ double score
253
268
  string explanation
254
269
  string trace_id
255
270
  string error
256
- json metadata
271
+ jsonb metadata
257
272
  datetime start_time
258
273
  datetime end_time
259
274
  }
260
275
 
276
+ DatasetSplit ||--o{ DatasetSplitsDatasetExample : contains
277
+ DatasetSplit ||--o{ ExperimentsDatasetSplit : used_in
278
+ DatasetSplit {
279
+ bigint id PK
280
+ string name
281
+ string description
282
+ string color
283
+ jsonb metadata
284
+ datetime created_at
285
+ datetime updated_at
286
+ bigint user_id FK
287
+ }
288
+
289
+ DatasetSplitsDatasetExample {
290
+ bigint dataset_split_id FK
291
+ bigint dataset_example_id FK
292
+ }
293
+
294
+ DatasetLabel ||--o{ DatasetsDatasetLabel : applies_to
295
+ DatasetLabel {
296
+ bigint id PK
297
+ string name
298
+ string description
299
+ string color
300
+ bigint user_id FK
301
+ }
302
+
303
+ DatasetsDatasetLabel {
304
+ int id PK
305
+ int dataset_id FK
306
+ int dataset_label_id FK
307
+ }
308
+
309
+ ExperimentTag {
310
+ bigint id PK
311
+ bigint experiment_id FK
312
+ bigint dataset_id FK
313
+ string name
314
+ string description
315
+ bigint user_id FK
316
+ }
317
+
318
+ ExperimentsDatasetExample {
319
+ bigint experiment_id FK
320
+ bigint dataset_example_id FK
321
+ bigint dataset_example_revision_id FK
322
+ }
323
+
324
+ ExperimentsDatasetSplit {
325
+ bigint experiment_id FK
326
+ bigint dataset_split_id FK
327
+ }
328
+
329
+ ProjectSessionAnnotation {
330
+ bigint id PK
331
+ bigint project_session_id FK
332
+ string name
333
+ string label
334
+ double score
335
+ string explanation
336
+ jsonb metadata
337
+ string annotator_kind
338
+ bigint user_id FK
339
+ string identifier
340
+ string source
341
+ datetime created_at
342
+ datetime updated_at
343
+ }
344
+
261
345
  User ||--o{ ApiKey : has
262
346
  User ||--o{ AccessToken : has
263
347
  User ||--o{ RefreshToken : has
@@ -267,6 +351,13 @@ erDiagram
267
351
  User ||--o{ SpanAnnotation : has
268
352
  User ||--o{ DocumentAnnotation : has
269
353
  User ||--o{ TraceAnnotation : has
354
+ User ||--o{ ProjectSessionAnnotation : has
355
+ User ||--o{ Experiment : creates
356
+ User ||--o{ ExperimentTag : creates
357
+ User ||--o{ DatasetLabel : creates
358
+ User ||--o{ Dataset : creates
359
+ User ||--o{ DatasetVersion : creates
360
+ User ||--o{ DatasetSplit : creates
270
361
  User {
271
362
  int id PK
272
363
  int user_role_id FK
@@ -298,6 +389,7 @@ erDiagram
298
389
  datetime expires_at
299
390
  }
300
391
 
392
+ RefreshToken ||--o| AccessToken : creates
301
393
  AccessToken {
302
394
  int id PK
303
395
  int user_id FK
@@ -323,13 +415,13 @@ erDiagram
323
415
  Prompt ||--o{ PromptVersion : has
324
416
  Prompt ||--o{ PromptPromptLabel : has
325
417
  Prompt ||--o{ PromptVersionTag : has
326
- Prompt ||--o{ Prompt : has
418
+ Prompt ||--o{ Prompt : derived_from
327
419
  Prompt {
328
420
  int id PK
329
421
  int source_prompt_id FK
330
422
  string name
331
423
  string description
332
- json metadata
424
+ jsonb metadata
333
425
  datetime created_at
334
426
  datetime updated_at
335
427
  }
@@ -342,13 +434,13 @@ erDiagram
342
434
  int user_id FK
343
435
  string template_type
344
436
  string template_format
345
- json template
346
- json invocation_parameters
437
+ jsonb template
438
+ jsonb invocation_parameters
347
439
  json tools
348
440
  json response_format
349
441
  string model_provider
350
442
  string model_name
351
- json metadata
443
+ jsonb metadata
352
444
  datetime created_at
353
445
  }
354
446
 
@@ -379,7 +471,7 @@ erDiagram
379
471
  AnnotationConfig {
380
472
  int id PK
381
473
  string name
382
- json config
474
+ jsonb config
383
475
  }
384
476
 
385
477
  ProjectAnnotationConfig {
@@ -387,4 +479,482 @@ erDiagram
387
479
  int project_id FK
388
480
  int annotation_config_id FK
389
481
  }
482
+
483
+ GenerativeModel ||--o{ TokenPrice : has
484
+ GenerativeModel ||--o{ SpanCost : used_in
485
+ GenerativeModel {
486
+ bigint id PK
487
+ string name
488
+ string provider
489
+ string name_pattern
490
+ boolean is_built_in
491
+ datetime start_time
492
+ datetime created_at
493
+ datetime updated_at
494
+ datetime deleted_at
495
+ }
496
+
497
+ TokenPrice {
498
+ bigint id PK
499
+ bigint model_id FK
500
+ string token_type
501
+ boolean is_prompt
502
+ double base_rate
503
+ json customization
504
+ }
505
+
506
+ SpanCost ||--o{ SpanCostDetail : has
507
+ SpanCost {
508
+ bigint id PK
509
+ bigint span_rowid FK
510
+ bigint trace_rowid FK
511
+ bigint model_id FK
512
+ datetime span_start_time
513
+ double total_cost
514
+ double total_tokens
515
+ double prompt_cost
516
+ double prompt_tokens
517
+ double completion_cost
518
+ double completion_tokens
519
+ }
520
+
521
+ SpanCostDetail {
522
+ bigint id PK
523
+ bigint span_cost_id FK
524
+ string token_type
525
+ boolean is_prompt
526
+ double cost
527
+ double tokens
528
+ double cost_per_token
529
+ }
530
+ ```
531
+
532
+ ---
533
+
534
+ ## Focused Relationship Views
535
+
536
+ > **Note**: The following subsection diagrams show simplified table structures focusing only on foreign keys to highlight relationships. These tables contain additional columns (including primary keys and other fields) not shown here - refer to the comprehensive ERD above for complete table definitions.
537
+
538
+ ### Core Tracing & Projects
539
+
540
+ This subgroup represents the core functionality of Phoenix - projects organize traces into sessions, traces contain spans, and retention policies manage data lifecycle:
541
+
542
+ ```mermaid
543
+ erDiagram
544
+ ProjectTraceRetentionPolicy ||--o{ Project : applied_to
545
+ ProjectTraceRetentionPolicy {
546
+ }
547
+
548
+ Project ||--o{ ProjectSession : has
549
+ Project ||--o{ Trace : has
550
+ Project {
551
+ int trace_retention_policy_id FK
552
+ }
553
+
554
+ ProjectSession ||--o{ Trace : has
555
+ ProjectSession {
556
+ int project_id FK
557
+ }
558
+
559
+ Trace ||--o{ Span : contains
560
+ Trace {
561
+ int project_rowid FK
562
+ int project_session_rowid FK
563
+ }
564
+
565
+ Span {
566
+ int trace_rowid FK
567
+ string parent_id
568
+ }
569
+ ```
570
+
571
+ ### Datasets & Data Management
572
+
573
+ This subgroup shows how datasets are created from spans, organized with versions and splits, and labeled for better organization:
574
+
575
+ ```mermaid
576
+ erDiagram
577
+ User ||--o{ DatasetLabel : creates
578
+ User ||--o{ Dataset : creates
579
+ User ||--o{ DatasetSplit : creates
580
+ User ||--o{ DatasetVersion : creates
581
+ User {
582
+ }
583
+
584
+ Trace ||--o{ Span : contains
585
+ Trace {
586
+ }
587
+
588
+ Span ||--o{ DatasetExample : becomes
589
+ Span {
590
+ int trace_rowid FK
591
+ }
592
+
593
+ Dataset ||--o{ DatasetVersion : has
594
+ Dataset ||--o{ DatasetExample : contains
595
+ Dataset ||--o{ DatasetsDatasetLabel : has
596
+ Dataset {
597
+ bigint user_id FK
598
+ }
599
+
600
+ DatasetVersion ||--o{ DatasetExampleRevision : has
601
+ DatasetVersion {
602
+ int dataset_id FK
603
+ bigint user_id FK
604
+ }
605
+
606
+ DatasetExample ||--o{ DatasetExampleRevision : has
607
+ DatasetExample ||--o{ DatasetSplitsDatasetExample : belongs_to
608
+ DatasetExample {
609
+ int dataset_id FK
610
+ int span_rowid FK
611
+ }
612
+
613
+ DatasetExampleRevision {
614
+ int dataset_example_id FK
615
+ int dataset_version_id FK
616
+ }
617
+
618
+ DatasetSplit ||--o{ DatasetSplitsDatasetExample : contains
619
+ DatasetSplit {
620
+ bigint user_id FK
621
+ }
622
+
623
+ DatasetSplitsDatasetExample {
624
+ bigint dataset_split_id FK
625
+ bigint dataset_example_id FK
626
+ }
627
+
628
+ DatasetLabel ||--o{ DatasetsDatasetLabel : applies_to
629
+ DatasetLabel {
630
+ bigint user_id FK
631
+ }
632
+
633
+ DatasetsDatasetLabel {
634
+ int dataset_id FK
635
+ int dataset_label_id FK
636
+ }
637
+ ```
638
+
639
+ ### Experiments & Evaluation
640
+
641
+ This subgroup shows how experiments use datasets to run evaluations, track results, and organize findings with tags and annotations:
642
+
643
+ ```mermaid
644
+ erDiagram
645
+ User ||--o{ Experiment : creates
646
+ User ||--o{ ExperimentTag : creates
647
+ User {
648
+ }
649
+
650
+ Dataset ||--o{ Experiment : used_in
651
+ Dataset {
652
+ }
653
+
654
+ DatasetVersion ||--o{ Experiment : used_in
655
+ DatasetVersion {
656
+ }
657
+
658
+ DatasetExample ||--o{ ExperimentRun : used_in
659
+ DatasetExample ||--o{ ExperimentsDatasetExample : linked_in
660
+ DatasetExample {
661
+ }
662
+
663
+ DatasetExampleRevision ||--o{ ExperimentsDatasetExample : revision_used
664
+ DatasetExampleRevision {
665
+ }
666
+
667
+ DatasetSplit ||--o{ ExperimentsDatasetSplit : used_in
668
+ DatasetSplit {
669
+ }
670
+
671
+ Experiment ||--o{ ExperimentRun : has
672
+ Experiment ||--o{ ExperimentTag : has
673
+ Experiment ||--o{ ExperimentsDatasetExample : includes
674
+ Experiment ||--o{ ExperimentsDatasetSplit : uses
675
+ Experiment {
676
+ int dataset_id FK
677
+ int dataset_version_id FK
678
+ bigint user_id FK
679
+ }
680
+
681
+ ExperimentRun ||--o{ ExperimentRunAnnotation : has
682
+ ExperimentRun {
683
+ int experiment_id FK
684
+ int dataset_example_id FK
685
+ string trace_id
686
+ }
687
+
688
+ ExperimentRunAnnotation {
689
+ int experiment_run_id FK
690
+ }
691
+
692
+ ExperimentTag {
693
+ bigint experiment_id FK
694
+ bigint dataset_id FK
695
+ bigint user_id FK
696
+ }
697
+
698
+ ExperimentsDatasetExample {
699
+ bigint experiment_id FK
700
+ bigint dataset_example_id FK
701
+ bigint dataset_example_revision_id FK
702
+ }
703
+
704
+ ExperimentsDatasetSplit {
705
+ bigint experiment_id FK
706
+ bigint dataset_split_id FK
707
+ }
708
+ ```
709
+
710
+ ### User Management & Authentication
711
+
712
+ This subgroup shows how users are managed with roles and different authentication methods:
713
+
714
+ ```mermaid
715
+ erDiagram
716
+ UserRole ||--o{ User : has
717
+ UserRole {
718
+ }
719
+
720
+ User ||--o{ ApiKey : has
721
+ User ||--o{ AccessToken : has
722
+ User ||--o{ RefreshToken : has
723
+ User ||--o{ PasswordResetToken : has
724
+ User {
725
+ int user_role_id FK
726
+ }
727
+
728
+ ApiKey {
729
+ int user_id FK
730
+ }
731
+
732
+ RefreshToken ||--o| AccessToken : creates
733
+ RefreshToken {
734
+ int user_id FK
735
+ }
736
+
737
+ AccessToken {
738
+ int user_id FK
739
+ int refresh_token_id FK
740
+ }
741
+
742
+ PasswordResetToken {
743
+ int user_id FK
744
+ }
745
+ ```
746
+
747
+ ### Annotations
748
+
749
+ This subgroup shows how annotations are attached to spans, documents, traces, and project sessions, including their configuration:
750
+
751
+ ```mermaid
752
+ erDiagram
753
+ Project ||--o{ ProjectAnnotationConfig : has
754
+ Project ||--o{ ProjectSession : has
755
+ Project ||--o{ Trace : has
756
+ Project {
757
+ }
758
+
759
+ ProjectSession ||--o{ ProjectSessionAnnotation : has
760
+ ProjectSession {
761
+ int project_id FK
762
+ }
763
+
764
+ Trace ||--o{ Span : contains
765
+ Trace ||--o{ TraceAnnotation : has
766
+ Trace {
767
+ int project_rowid FK
768
+ }
769
+
770
+ Span ||--o{ SpanAnnotation : has
771
+ Span ||--o{ DocumentAnnotation : has
772
+ Span {
773
+ int trace_rowid FK
774
+ }
775
+
776
+ User ||--o{ SpanAnnotation : creates
777
+ User ||--o{ DocumentAnnotation : creates
778
+ User ||--o{ TraceAnnotation : creates
779
+ User ||--o{ ProjectSessionAnnotation : creates
780
+ User {
781
+ }
782
+
783
+ AnnotationConfig ||--o{ ProjectAnnotationConfig : configures
784
+ AnnotationConfig {
785
+ }
786
+
787
+ ProjectAnnotationConfig {
788
+ int project_id FK
789
+ int annotation_config_id FK
790
+ }
791
+
792
+ SpanAnnotation {
793
+ int span_rowid FK
794
+ int user_id FK
795
+ }
796
+
797
+ DocumentAnnotation {
798
+ int span_rowid FK
799
+ int user_id FK
800
+ }
801
+
802
+ TraceAnnotation {
803
+ int trace_rowid FK
804
+ int user_id FK
805
+ }
806
+
807
+ ProjectSessionAnnotation {
808
+ bigint project_session_id FK
809
+ bigint user_id FK
810
+ }
811
+ ```
812
+
813
+ ### Prompts
814
+
815
+ This subgroup shows how users create and manage prompt templates, versions, labels, and tags:
816
+
817
+ ```mermaid
818
+ erDiagram
819
+ User ||--o{ PromptVersion : creates
820
+ User ||--o{ PromptVersionTag : creates
821
+ User {
822
+ }
823
+
824
+ Prompt ||--o{ PromptVersion : has
825
+ Prompt ||--o{ PromptPromptLabel : has
826
+ Prompt ||--o{ PromptVersionTag : has
827
+ Prompt ||--o{ Prompt : derived_from
828
+ Prompt {
829
+ int source_prompt_id FK
830
+ }
831
+
832
+ PromptVersion ||--o{ PromptVersionTag : has
833
+ PromptVersion {
834
+ int prompt_id FK
835
+ int user_id FK
836
+ }
837
+
838
+ PromptLabel ||--o{ PromptPromptLabel : has
839
+ PromptLabel {
840
+ }
841
+
842
+ PromptPromptLabel {
843
+ int prompt_label_id FK
844
+ int prompt_id FK
845
+ }
846
+
847
+ PromptVersionTag {
848
+ int prompt_id FK
849
+ int prompt_version_id FK
850
+ int user_id FK
851
+ }
390
852
  ```
853
+
854
+ ### Cost & Pricing
855
+
856
+ This subgroup shows how LLM costs are calculated and tracked for spans and traces:
857
+
858
+ ```mermaid
859
+ erDiagram
860
+ Trace ||--o{ Span : contains
861
+ Trace ||--o{ SpanCost : tracks
862
+ Trace {
863
+ }
864
+
865
+ Span ||--o{ SpanCost : generates
866
+ Span {
867
+ int trace_rowid FK
868
+ }
869
+
870
+ GenerativeModel ||--o{ TokenPrice : defines
871
+ GenerativeModel ||--o{ SpanCost : calculates
872
+ GenerativeModel {
873
+ }
874
+
875
+ TokenPrice {
876
+ bigint model_id FK
877
+ }
878
+
879
+ SpanCost ||--o{ SpanCostDetail : has
880
+ SpanCost {
881
+ bigint span_rowid FK
882
+ bigint trace_rowid FK
883
+ bigint model_id FK
884
+ }
885
+
886
+ SpanCostDetail {
887
+ bigint span_cost_id FK
888
+ }
889
+ ```
890
+
891
+ ### User-Created Content
892
+
893
+ This subgroup shows all entities that track user ownership through user_id foreign keys, representing content created or managed by users across datasets, experiments, prompts, and annotations:
894
+
895
+ ```mermaid
896
+ erDiagram
897
+ User ||--o{ Dataset : creates
898
+ User ||--o{ DatasetVersion : creates
899
+ User ||--o{ DatasetSplit : creates
900
+ User ||--o{ DatasetLabel : creates
901
+ User ||--o{ Experiment : creates
902
+ User ||--o{ ExperimentTag : creates
903
+ User ||--o{ PromptVersion : creates
904
+ User ||--o{ PromptVersionTag : creates
905
+ User ||--o{ SpanAnnotation : creates
906
+ User ||--o{ DocumentAnnotation : creates
907
+ User ||--o{ TraceAnnotation : creates
908
+ User ||--o{ ProjectSessionAnnotation : creates
909
+ User {
910
+ }
911
+
912
+ Dataset {
913
+ bigint user_id FK
914
+ }
915
+
916
+ DatasetVersion {
917
+ bigint user_id FK
918
+ }
919
+
920
+ DatasetSplit {
921
+ bigint user_id FK
922
+ }
923
+
924
+ DatasetLabel {
925
+ bigint user_id FK
926
+ }
927
+
928
+ Experiment {
929
+ bigint user_id FK
930
+ }
931
+
932
+ ExperimentTag {
933
+ bigint user_id FK
934
+ }
935
+
936
+ PromptVersion {
937
+ int user_id FK
938
+ }
939
+
940
+ PromptVersionTag {
941
+ int user_id FK
942
+ }
943
+
944
+ SpanAnnotation {
945
+ int user_id FK
946
+ }
947
+
948
+ DocumentAnnotation {
949
+ int user_id FK
950
+ }
951
+
952
+ TraceAnnotation {
953
+ int user_id FK
954
+ }
955
+
956
+ ProjectSessionAnnotation {
957
+ bigint user_id FK
958
+ }
959
+ ```
960
+