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

Potentially problematic release.


This version of arize-phoenix might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arize-phoenix
3
- Version: 11.15.0
3
+ Version: 11.16.1
4
4
  Summary: AI Observability and Evaluation
5
5
  Project-URL: Documentation, https://arize.com/docs/phoenix/
6
6
  Project-URL: Issues, https://github.com/Arize-ai/phoenix/issues
@@ -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=ngkyKGVatX3cO2WJdo2hKdaVKP-xJCMvqthvga6kJss,5196
8
8
  phoenix/settings.py,sha256=2kHfT3BNOVd4dAO1bq-syEQbHSG8oX2-7NhOwK2QREk,896
9
- phoenix/version.py,sha256=W6kx40mj0SUHyBQQqw1zvDl_2qQBQ-TkvJWoEy2ezRk,24
9
+ phoenix/version.py,sha256=la5dgqPaLH76UOsPrzq3yXc1oRancntE_Rtl5KYWzoM,24
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
@@ -22,7 +22,7 @@ phoenix/db/enums.py,sha256=w3O5YuJEEzVTwVDZb8b2UUFhU8yK_GosF081VVrrno0,188
22
22
  phoenix/db/facilitator.py,sha256=aRbkIJkIDP2zMsLKbO7Y8jJq4U2HbV7Lf6GYVWXVImU,20151
23
23
  phoenix/db/helpers.py,sha256=dsGONSgkhmVtjMpJh-84KRVTf5uPdQ5c8O2AhUgHkRg,14150
24
24
  phoenix/db/migrate.py,sha256=oUrXH8yEbcpL4eh09aSCuUiSrhFli0eT5D_j4ZmYChY,2797
25
- phoenix/db/models.py,sha256=0avhbUmDEBZ1_NgBSr9Ck9BYxXtJTraPfQqDGZFE2-Y,60388
25
+ phoenix/db/models.py,sha256=bxyBRSST8rqBKcAyPyyDHmkv9AadaE3XmQnpcaMvvnk,61588
26
26
  phoenix/db/pg_config.py,sha256=h6mB7qF7t4Zk6VGvAiyefHGVu74o-yJynaWzeE39k9Y,6001
27
27
  phoenix/db/insertion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  phoenix/db/insertion/constants.py,sha256=8wifm7X-1XvroZ__R2Gc96NsgLhTDn0zXl4lehlXtcA,70
@@ -95,7 +95,7 @@ phoenix/server/app.py,sha256=00un2qg4eUmHr37TtZlccmPgRnI1D5FB5r2zwIfI9W4,48047
95
95
  phoenix/server/authorization.py,sha256=OxROn7ibpKtCTrcgDkzWuNxVaQcSQ8MAx7zbjZiliK0,3201
96
96
  phoenix/server/bearer_auth.py,sha256=f4v4W94KyTdGGCPsK1tXOe0vouPuvanAEa03XSdCvPE,6650
97
97
  phoenix/server/dml_event.py,sha256=8UciN7W8X_IqQfAnAeAh68BezNmfxSxuTeD6IUerTW8,2911
98
- phoenix/server/dml_event_handler.py,sha256=gkDIONyTz9sLbSA6qOZCigiO5val-fvVcLzDrWNcVcg,8306
98
+ phoenix/server/dml_event_handler.py,sha256=71_iPcHiJ4E-8Z7sGL2j0vx_RpkmcMVEUFIBsWrdp-E,8483
99
99
  phoenix/server/grpc_server.py,sha256=ahHC394gFZYM3h4FmjQxZwL-a4x3mWmV2EdXYFlNEC8,4676
100
100
  phoenix/server/jwt_store.py,sha256=B6uVildN_dQDTG_-aHHvuVSI7wIVK1yvED-_y6se2GU,16905
101
101
  phoenix/server/main.py,sha256=UBwxrQIEE7ci-SbE6GAlRYmbMHooI6JYG6sG-UpBFFs,18905
@@ -114,7 +114,7 @@ phoenix/server/api/exceptions.py,sha256=E2W0x63CBzc0CoQPptrLr9nZxPF9zIP8MCJ3RuJM
114
114
  phoenix/server/api/interceptor.py,sha256=ykDnoC_apUd-llVli3m1CW18kNSIgjz2qZ6m5JmPDu8,1294
115
115
  phoenix/server/api/queries.py,sha256=--ycVajCdDuN4Y-7bnD9py3BIXVWnZEwrpwDEW2Y8i4,46498
116
116
  phoenix/server/api/schema.py,sha256=fcs36xQwFF_Qe41_5cWR8wYpDvOrnbcyTeo5WNMbDsA,1702
117
- phoenix/server/api/subscriptions.py,sha256=ZOGNsLVr5TNjCWgbzO7Eq6Ls_NRdJH9AxC0cW_v0vhM,25332
117
+ phoenix/server/api/subscriptions.py,sha256=U7JZl-FGfsaIhRkIFdeSQLqR7xCS7CY1h-21BOAcaqY,25439
118
118
  phoenix/server/api/utils.py,sha256=quCBRcusc6PUq9tJq7M8PgwFZp7nXgVAxtbw8feribY,833
119
119
  phoenix/server/api/dataloaders/__init__.py,sha256=ddiX1BdbyGkPTzMZNo-hkF_2kqIquelBUFvQejnAJYk,6834
120
120
  phoenix/server/api/dataloaders/annotation_configs_by_project.py,sha256=_Nfiug9o01JimU3Z0LpZJ0uaMCjchXomyt_dYAxPFRY,1178
@@ -232,7 +232,7 @@ phoenix/server/api/input_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
232
232
  phoenix/server/api/mutations/__init__.py,sha256=DlAwXDKQzOpY4vFiDUR9Cu2kmncFr4m-RPRyQABBPIE,1972
233
233
  phoenix/server/api/mutations/annotation_config_mutations.py,sha256=i7NsQhYICcQ-I-tnFjGtVAYc8WVmMBacmRaqHWJ25t4,15433
234
234
  phoenix/server/api/mutations/api_key_mutations.py,sha256=nfnRjALCaQMi_jIbEPW4G3Dn3tPnmZVU11tpBbBijGA,6242
235
- phoenix/server/api/mutations/chat_mutations.py,sha256=97g5OEpFklS2hI73ACCzpRBq5s_h9-nxzbUr82XmU-8,24373
235
+ phoenix/server/api/mutations/chat_mutations.py,sha256=KB9_39rcGWI8x687ktAiijgww-P8B9mVJKnyL8NCmKQ,24647
236
236
  phoenix/server/api/mutations/dataset_mutations.py,sha256=KRlF-Ag3twqaBpLR_6WYxf57DffaGuFBm-soaBPStbI,27787
237
237
  phoenix/server/api/mutations/experiment_mutations.py,sha256=p3CoLAa8nFPa3D759Y2A7De_PVJNGOL98mA3HoZBrRQ,3188
238
238
  phoenix/server/api/mutations/export_events_mutations.py,sha256=xoDnVWC7eA_8wNQP0-oyiHojyUZ0EhVVSrsAnztetC0,3993
@@ -261,12 +261,12 @@ phoenix/server/api/routers/v1/datasets.py,sha256=9iPORLmbOrPKgUUcRDMs6ZczSIz7hvc
261
261
  phoenix/server/api/routers/v1/evaluations.py,sha256=_I0X01J8EZmTlfAGkvMkZ05IB3x691xzUmHV05ov26Y,12914
262
262
  phoenix/server/api/routers/v1/experiment_evaluations.py,sha256=_xnVqFCwZoOUPravdPixZLSQiU1H3sB5EzMknB7E1CI,4837
263
263
  phoenix/server/api/routers/v1/experiment_runs.py,sha256=LZeCQWQIEOZ9jK5Gp_C4JbiYY6AmnnWe85cVcvdkCLE,7107
264
- phoenix/server/api/routers/v1/experiments.py,sha256=osy0JG_iVSCkoRi__0tjldfS5zzBDvNfv-GimbP4ShA,20537
264
+ phoenix/server/api/routers/v1/experiments.py,sha256=wML-cad0NiflFGIysaJECFulXLqj5rjwMmNmKQVaGzw,20592
265
265
  phoenix/server/api/routers/v1/models.py,sha256=p3gJN-9SWiUYTUTft4bZMsZVCBNTb4nN1Foy68eRZzQ,1997
266
266
  phoenix/server/api/routers/v1/projects.py,sha256=32GwTLsaFgQLVNdjrlrGe90XT3pIX1N7-zX9D9_J_4w,12701
267
267
  phoenix/server/api/routers/v1/prompts.py,sha256=chRYcLkOYDJdJfVZVukVTUyIRnLPvsJCg41CuPxOIU8,26695
268
268
  phoenix/server/api/routers/v1/spans.py,sha256=ETH6I14O_zY9IW69Fo-LxL796BR3xgt8qdzwqzYAvbE,44208
269
- phoenix/server/api/routers/v1/traces.py,sha256=63T-WYiwh8X3Sp6u_OFfA9zLLKk6cNsnciiDyUzKLVk,8561
269
+ phoenix/server/api/routers/v1/traces.py,sha256=uLASCHMgU13tUhuWXnXqaom1crrQVpXi9PUtsyDXU9Y,10318
270
270
  phoenix/server/api/routers/v1/users.py,sha256=hUZCe7ctJqEkSJBe046a0OAFMLZodtyO7NLP7U6S8Pg,11986
271
271
  phoenix/server/api/routers/v1/utils.py,sha256=oXIOGPzPTkE0ZWUTRCoRIQQ7wTzoSwtWFaUSjlGBqts,4960
272
272
  phoenix/server/api/types/Annotation.py,sha256=gsl8CwjIbDUbZRj4d9USwZ_w_Tkz4i7zuZh9ftV80jA,1132
@@ -321,7 +321,7 @@ phoenix/server/api/types/ModelInterface.py,sha256=Qe7H23wDb_Q2-HmeY2t0R5Jsn4aAfY
321
321
  phoenix/server/api/types/NumericRange.py,sha256=afEjgF97Go_OvmjMggbPBt-zGM8IONewAyEiKEHRds0,192
322
322
  phoenix/server/api/types/PerformanceMetric.py,sha256=KFkmJDqP43eDUtARQOUqR7NYcxvL6Vh2uisHWU6H3ko,387
323
323
  phoenix/server/api/types/PlaygroundModel.py,sha256=IqJFxsAAJMRyaFI9ryI3GQrpFOJ5Llf6kIutEO-tFvM,321
324
- phoenix/server/api/types/Project.py,sha256=u_Rlk61xrv5ZoJdOl5ghG1Wo7TK1eqydDZ7GeNPDgLM,69630
324
+ phoenix/server/api/types/Project.py,sha256=AxKlA7FHlI48uRKx5-MRzMzEyyWPZPffX_iZOV0jeJs,69652
325
325
  phoenix/server/api/types/ProjectSession.py,sha256=uwqTsDTfSGz13AvP-cwS_mJR5JZ1lHqu10ungbl7g5s,6245
326
326
  phoenix/server/api/types/ProjectTraceRetentionPolicy.py,sha256=tYy2kgalPDyuaYZr0VUHjH0YpXaiF_QOzg5yfaV_c7c,3782
327
327
  phoenix/server/api/types/Prompt.py,sha256=ccP4eq1e38xbF0afclGWLOuDpBVpNbJ3AOSRClF8yFQ,4955
@@ -376,6 +376,8 @@ phoenix/server/email/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
376
376
  phoenix/server/email/templates/db_disk_usage_notification.html,sha256=Atv2XnKkC7HasTTCZYAWySr7VbupAGwbIiJ9eQ4r2l0,906
377
377
  phoenix/server/email/templates/password_reset.html,sha256=jv0Pe-06JloPZcubRWxPdAFHYEn9eDj_4SjmuoIwshI,441
378
378
  phoenix/server/email/templates/welcome.html,sha256=AyVsIOtpmyYwWmmkXjuEgXwkbsag4YHHKfkmOTiNo-M,316
379
+ phoenix/server/experiments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
380
+ phoenix/server/experiments/utils.py,sha256=I8OSkjLse7eVJasyiBwql7ihzOrMivsxOQVhD8aWi1E,356
379
381
  phoenix/server/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
380
382
  phoenix/server/middleware/gzip.py,sha256=hoznxxXdJlb6_XSyNXFz0OLd9FhtCHv6Tm0TWh0Zijk,1363
381
383
  phoenix/server/openapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -389,9 +391,9 @@ phoenix/server/static/apple-touch-icon-76x76.png,sha256=CT_xT12I0u2i0WU8JzBZBuOQ
389
391
  phoenix/server/static/apple-touch-icon.png,sha256=fOfpjqGpWYbJ0eAurKsyoZP1EAs6ZVooBJ_SGk2ZkDs,3801
390
392
  phoenix/server/static/favicon.ico,sha256=bY0vvCKRftemZfPShwZtE93DiiQdaYaozkPGwNFr6H8,34494
391
393
  phoenix/server/static/modernizr.js,sha256=mvK-XtkNqjOral-QvzoqsyOMECXIMu5BQwSVN_wcU9c,2564
392
- phoenix/server/static/.vite/manifest.json,sha256=kdJluW5SaIjnZ4iseFuA4LCG0bVknsw1pSXJT2h3XLo,2165
394
+ phoenix/server/static/.vite/manifest.json,sha256=7tNByP86-7b3NZxsgZFyq4MpRPrPaeFlINZoRP8NRkE,2165
393
395
  phoenix/server/static/assets/components-CK8hwrPx.js,sha256=g1vGnQRiqgG1yDDRMSbiUES-P4kkwsUbl4BPl9EH3Ek,650224
394
- phoenix/server/static/assets/index-ByWTGseQ.js,sha256=S6_w9RczLWlZc2MxJ5_G_Z7O464nyUIQcns2SXhtAHU,63020
396
+ phoenix/server/static/assets/index-UY6kXBX7.js,sha256=N-wk2Jml93MqnFKzVtzlcb6G5kquwPu06_FWFLfQxXU,63064
395
397
  phoenix/server/static/assets/pages-D8Hgmz1V.js,sha256=zVZMTQw6vFjJPf9FjvfXpYwosimlWXCGtMnwxNBbMKs,1208677
396
398
  phoenix/server/static/assets/vendor-CqDb5u4o.css,sha256=zIyFiNJKxMaQk8AvtLgt1rR01oO10d1MFndSDKH9Clw,5517
397
399
  phoenix/server/static/assets/vendor-_6rG8OMg.js,sha256=stdw5w5Q5kJ0EkGpzu_f_IYaEEwKHkn3eNDZSxBRQUE,2682340
@@ -439,9 +441,9 @@ phoenix/utilities/project.py,sha256=auVpARXkDb-JgeX5f2aStyFIkeKvGwN9l7qrFeJMVxI,
439
441
  phoenix/utilities/re.py,sha256=6YyUWIkv0zc2SigsxfOWIHzdpjKA_TZo2iqKq7zJKvw,2081
440
442
  phoenix/utilities/span_store.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
441
443
  phoenix/utilities/template_formatters.py,sha256=gh9PJD6WEGw7TEYXfSst1UR4pWWwmjxMLrDVQ_CkpkQ,2779
442
- arize_phoenix-11.15.0.dist-info/METADATA,sha256=fTesMufMP3UOzOvqbdz-tSZUGvICm1OpUgz3TMf1Bsg,30851
443
- arize_phoenix-11.15.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
444
- arize_phoenix-11.15.0.dist-info/entry_points.txt,sha256=Pgpn8Upxx9P8z8joPXZWl2LlnAlGc3gcQoVchb06X1Q,94
445
- arize_phoenix-11.15.0.dist-info/licenses/IP_NOTICE,sha256=JBqyyCYYxGDfzQ0TtsQgjts41IJoa-hiwDrBjCb9gHM,469
446
- arize_phoenix-11.15.0.dist-info/licenses/LICENSE,sha256=HFkW9REuMOkvKRACuwLPT0hRydHb3zNg-fdFt94td18,3794
447
- arize_phoenix-11.15.0.dist-info/RECORD,,
444
+ arize_phoenix-11.16.1.dist-info/METADATA,sha256=ueQTCyUpZNKsx4_LOt6KkqVkK__SbVbvYWX8ZjKgRVk,30851
445
+ arize_phoenix-11.16.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
446
+ arize_phoenix-11.16.1.dist-info/entry_points.txt,sha256=Pgpn8Upxx9P8z8joPXZWl2LlnAlGc3gcQoVchb06X1Q,94
447
+ arize_phoenix-11.16.1.dist-info/licenses/IP_NOTICE,sha256=JBqyyCYYxGDfzQ0TtsQgjts41IJoa-hiwDrBjCb9gHM,469
448
+ arize_phoenix-11.16.1.dist-info/licenses/LICENSE,sha256=HFkW9REuMOkvKRACuwLPT0hRydHb3zNg-fdFt94td18,3794
449
+ arize_phoenix-11.16.1.dist-info/RECORD,,
phoenix/db/models.py CHANGED
@@ -841,6 +841,41 @@ def _(element: Any, compiler: Any, **kw: Any) -> Any:
841
841
  return compiler.process(func.text_contains(string, substring) > 0, **kw)
842
842
 
843
843
 
844
+ class CaseInsensitiveContains(expression.FunctionElement[bool]):
845
+ # See https://docs.sqlalchemy.org/en/20/core/compiler.html
846
+ inherit_cache = True
847
+ type = Boolean()
848
+ name = "case_insensitive_contains"
849
+
850
+
851
+ @compiles(CaseInsensitiveContains)
852
+ def _(element: Any, compiler: Any, **kw: Any) -> Any:
853
+ string, substring = list(element.clauses)
854
+ result = compiler.process(func.lower(string).contains(func.lower(substring)), **kw)
855
+ return result
856
+
857
+
858
+ @compiles(CaseInsensitiveContains, "postgresql")
859
+ def _(element: Any, compiler: Any, **kw: Any) -> Any:
860
+ string, substring = list(element.clauses)
861
+ escaped = func.replace(
862
+ func.replace(func.replace(substring, "\\", "\\\\"), "%", "\\%"), "_", "\\_"
863
+ )
864
+ pattern = func.concat("%", escaped, "%")
865
+ result = compiler.process(string.ilike(pattern), **kw)
866
+ return result
867
+
868
+
869
+ @compiles(CaseInsensitiveContains, "sqlite")
870
+ def _(element: Any, compiler: Any, **kw: Any) -> Any:
871
+ # Use sqlean's `text_lower` to handle non-ASCII characters
872
+ string, substring = list(element.clauses)
873
+ result = compiler.process(
874
+ func.text_contains(func.text_lower(string), func.text_lower(substring)), **kw
875
+ )
876
+ return result
877
+
878
+
844
879
  async def init_models(engine: AsyncEngine) -> None:
845
880
  async with engine.begin() as conn:
846
881
  await conn.run_sync(Base.metadata.create_all)
@@ -23,6 +23,7 @@ from strawberry.relay import GlobalID
23
23
  from strawberry.types import Info
24
24
  from typing_extensions import assert_never
25
25
 
26
+ from phoenix.config import PLAYGROUND_PROJECT_NAME
26
27
  from phoenix.datetime_utils import local_now, normalize_datetime
27
28
  from phoenix.db import models
28
29
  from phoenix.db.helpers import get_dataset_example_revisions
@@ -64,6 +65,7 @@ from phoenix.server.api.types.DatasetVersion import DatasetVersion
64
65
  from phoenix.server.api.types.node import from_global_id_with_expected_type
65
66
  from phoenix.server.api.types.Span import Span
66
67
  from phoenix.server.dml_event import SpanInsertEvent
68
+ from phoenix.server.experiments.utils import generate_experiment_project_name
67
69
  from phoenix.trace.attributes import unflatten
68
70
  from phoenix.trace.schemas import SpanException
69
71
  from phoenix.utilities.json import jsonify
@@ -163,6 +165,7 @@ class ChatCompletionMutationMixin:
163
165
  if input.dataset_version_id
164
166
  else None
165
167
  )
168
+ project_name = generate_experiment_project_name()
166
169
  async with info.context.db() as session:
167
170
  dataset = await session.scalar(select(models.Dataset).filter_by(id=dataset_id))
168
171
  if dataset is None:
@@ -196,7 +199,7 @@ class ChatCompletionMutationMixin:
196
199
  description=input.experiment_description,
197
200
  repetitions=1,
198
201
  metadata_=input.experiment_metadata or dict(),
199
- project_name=PLAYGROUND_PROJECT_NAME,
202
+ project_name=project_name,
200
203
  )
201
204
  session.add(experiment)
202
205
  await session.flush()
@@ -222,6 +225,7 @@ class ChatCompletionMutationMixin:
222
225
  ),
223
226
  prompt_name=input.prompt_name,
224
227
  ),
228
+ project_name=project_name,
225
229
  )
226
230
  for revision in batch
227
231
  ),
@@ -320,6 +324,8 @@ class ChatCompletionMutationMixin:
320
324
  info: Info[Context, None],
321
325
  llm_client: PlaygroundStreamingClient,
322
326
  input: ChatCompletionInput,
327
+ project_name: str = PLAYGROUND_PROJECT_NAME,
328
+ project_description: str = "Traces from prompt playground",
323
329
  ) -> ChatCompletionMutationPayload:
324
330
  attributes: dict[str, Any] = {}
325
331
  attributes.update(dict(prompt_metadata(input.prompt_name)))
@@ -414,15 +420,15 @@ class ChatCompletionMutationMixin:
414
420
  # Get or create the project ID
415
421
  if (
416
422
  project_id := await session.scalar(
417
- select(models.Project.id).where(models.Project.name == PLAYGROUND_PROJECT_NAME)
423
+ select(models.Project.id).where(models.Project.name == project_name)
418
424
  )
419
425
  ) is None:
420
426
  project_id = await session.scalar(
421
427
  insert(models.Project)
422
428
  .returning(models.Project.id)
423
429
  .values(
424
- name=PLAYGROUND_PROJECT_NAME,
425
- description="Traces from prompt playground",
430
+ name=project_name,
431
+ description=project_description,
426
432
  )
427
433
  )
428
434
  trace = models.Trace(
@@ -622,5 +628,3 @@ TOOL_JSON_SCHEMA = ToolAttributes.TOOL_JSON_SCHEMA
622
628
  PROMPT_TEMPLATE_VARIABLES = SpanAttributes.LLM_PROMPT_TEMPLATE_VARIABLES
623
629
 
624
630
  LLM_PROVIDER = SpanAttributes.LLM_PROVIDER
625
-
626
- PLAYGROUND_PROJECT_NAME = "playground"
@@ -20,6 +20,7 @@ from phoenix.db.insertion.helpers import insert_on_conflict
20
20
  from phoenix.server.api.types.node import from_global_id_with_expected_type
21
21
  from phoenix.server.authorization import is_not_locked
22
22
  from phoenix.server.dml_event import ExperimentInsertEvent
23
+ from phoenix.server.experiments.utils import generate_experiment_project_name
23
24
 
24
25
  from .models import V1RoutesBaseModel
25
26
  from .utils import ResponseBody, add_errors_to_responses, add_text_csv_content_to_responses
@@ -159,7 +160,7 @@ async def create_experiment(
159
160
 
160
161
  # generate a semi-unique name for the experiment
161
162
  experiment_name = request_body.name or _generate_experiment_name(dataset_name)
162
- project_name = f"Experiment-{getrandbits(96).to_bytes(12, 'big').hex()}"
163
+ project_name = generate_experiment_project_name()
163
164
  project_description = (
164
165
  f"dataset_id: {dataset_globalid}\ndataset_version_id: {dataset_version_globalid}"
165
166
  )
@@ -2,14 +2,14 @@ import gzip
2
2
  import zlib
3
3
  from typing import Any, Literal, Optional
4
4
 
5
- from fastapi import APIRouter, BackgroundTasks, Depends, Header, HTTPException, Query
5
+ from fastapi import APIRouter, BackgroundTasks, Depends, Header, HTTPException, Path, Query
6
6
  from google.protobuf.message import DecodeError
7
7
  from opentelemetry.proto.collector.trace.v1.trace_service_pb2 import (
8
8
  ExportTraceServiceRequest,
9
9
  ExportTraceServiceResponse,
10
10
  )
11
11
  from pydantic import Field
12
- from sqlalchemy import insert, select
12
+ from sqlalchemy import delete, insert, select
13
13
  from starlette.concurrency import run_in_threadpool
14
14
  from starlette.datastructures import State
15
15
  from starlette.requests import Request
@@ -26,7 +26,7 @@ from phoenix.db.insertion.helpers import as_kv
26
26
  from phoenix.db.insertion.types import Precursors
27
27
  from phoenix.server.authorization import is_not_locked
28
28
  from phoenix.server.bearer_auth import PhoenixUser
29
- from phoenix.server.dml_event import TraceAnnotationInsertEvent
29
+ from phoenix.server.dml_event import SpanDeleteEvent, TraceAnnotationInsertEvent
30
30
  from phoenix.trace.otel import decode_otlp_span
31
31
  from phoenix.utilities.project import get_project_name
32
32
 
@@ -225,3 +225,52 @@ async def _add_spans(req: ExportTraceServiceRequest, state: State) -> None:
225
225
  for otlp_span in scope_span.spans:
226
226
  span = await run_in_threadpool(decode_otlp_span, otlp_span)
227
227
  await state.queue_span_for_bulk_insert(span, project_name)
228
+
229
+
230
+ @router.delete(
231
+ "/traces/{trace_id}",
232
+ operation_id="deleteTrace",
233
+ summary="Delete a trace by trace_id",
234
+ description=(
235
+ "Delete an entire trace by its OpenTelemetry trace_id. "
236
+ "This will permanently remove all spans in the trace and their associated data."
237
+ ),
238
+ responses=add_errors_to_responses([HTTP_404_NOT_FOUND]),
239
+ status_code=204, # No Content for successful deletion
240
+ )
241
+ async def delete_trace(
242
+ request: Request,
243
+ trace_id: str = Path(description="The OpenTelemetry trace_id of the trace to delete"),
244
+ ) -> None:
245
+ """
246
+ Delete a trace by trace_id.
247
+
248
+ This endpoint will:
249
+ 1. Find and delete the trace with the given trace_id (and all its spans via CASCADE)
250
+ 2. Trigger cache invalidation events
251
+ 3. Return 204 No Content on success
252
+
253
+ Note: This deletes the entire trace, including all spans, which maintains data consistency
254
+ and avoids orphaned spans or inconsistent cached cumulative fields.
255
+ """
256
+ async with request.app.state.db() as session:
257
+ # Delete the trace directly and get project_id for cache invalidation
258
+ delete_stmt = (
259
+ delete(models.Trace)
260
+ .where(models.Trace.trace_id == trace_id)
261
+ .returning(models.Trace.project_rowid)
262
+ )
263
+
264
+ project_id = await session.scalar(delete_stmt)
265
+
266
+ if project_id is None:
267
+ raise HTTPException(
268
+ status_code=HTTP_404_NOT_FOUND,
269
+ detail=f"Trace with trace_id '{trace_id}' not found",
270
+ )
271
+
272
+ # Trigger cache invalidation event
273
+ request.state.event_queue.put(SpanDeleteEvent((project_id,)))
274
+
275
+ # Return 204 No Content (successful deletion with no response body)
276
+ return None
@@ -64,6 +64,7 @@ from phoenix.server.api.types.node import from_global_id_with_expected_type
64
64
  from phoenix.server.api.types.Span import Span
65
65
  from phoenix.server.daemons.span_cost_calculator import SpanCostCalculator
66
66
  from phoenix.server.dml_event import SpanInsertEvent
67
+ from phoenix.server.experiments.utils import generate_experiment_project_name
67
68
  from phoenix.server.types import DbSessionFactory
68
69
  from phoenix.utilities.template_formatters import (
69
70
  FStringTemplateFormatter,
@@ -287,16 +288,17 @@ class Subscription:
287
288
  ]
288
289
  ):
289
290
  raise NotFound("No examples found for the given dataset and version")
291
+ project_name = generate_experiment_project_name()
290
292
  if (
291
293
  playground_project_id := await session.scalar(
292
- select(models.Project.id).where(models.Project.name == PLAYGROUND_PROJECT_NAME)
294
+ select(models.Project.id).where(models.Project.name == project_name)
293
295
  )
294
296
  ) is None:
295
297
  playground_project_id = await session.scalar(
296
298
  insert(models.Project)
297
299
  .returning(models.Project.id)
298
300
  .values(
299
- name=PLAYGROUND_PROJECT_NAME,
301
+ name=project_name,
300
302
  description="Traces from prompt playground",
301
303
  )
302
304
  )
@@ -308,7 +310,7 @@ class Subscription:
308
310
  description=input.experiment_description,
309
311
  repetitions=1,
310
312
  metadata_=input.experiment_metadata or dict(),
311
- project_name=PLAYGROUND_PROJECT_NAME,
313
+ project_name=project_name,
312
314
  )
313
315
  session.add(experiment)
314
316
  await session.flush()
@@ -404,11 +404,11 @@ class Project(Node):
404
404
  .where(models.Span.parent_id.is_(None))
405
405
  .where(
406
406
  or_(
407
- models.TextContains(
407
+ models.CaseInsensitiveContains(
408
408
  models.Span.attributes[INPUT_VALUE].as_string(),
409
409
  filter_io_substring,
410
410
  ),
411
- models.TextContains(
411
+ models.CaseInsensitiveContains(
412
412
  models.Span.attributes[OUTPUT_VALUE].as_string(),
413
413
  filter_io_substring,
414
414
  ),
@@ -128,6 +128,10 @@ class _SpanDmlEventHandler(_DmlEventHandler[SpanDmlEvent]):
128
128
  class _SpanDeleteEventHandler(_SpanDmlEventHandler):
129
129
  @staticmethod
130
130
  def _clear(cache: CacheForDataLoaders, project_id: int) -> None:
131
+ # Call parent's cache invalidation first (core span caches)
132
+ _SpanDmlEventHandler._clear(cache, project_id)
133
+
134
+ # Then invalidate annotation-specific caches
131
135
  cache.annotation_summary.invalidate_project(project_id)
132
136
  cache.document_evaluation_summary.invalidate_project(project_id)
133
137
 
File without changes
@@ -0,0 +1,14 @@
1
+ from __future__ import annotations
2
+
3
+ import re
4
+ from secrets import token_hex
5
+
6
+ EXPERIMENT_PROJECT_NAME_PATTERN = re.compile(r"^Experiment-[0-9a-f]{24}$")
7
+
8
+
9
+ def generate_experiment_project_name() -> str:
10
+ return f"Experiment-{token_hex(12)}"
11
+
12
+
13
+ def is_experiment_project_name(name: str) -> bool:
14
+ return bool(EXPERIMENT_PROJECT_NAME_PATTERN.match(name))
@@ -69,7 +69,7 @@
69
69
  "name": "vendor-three"
70
70
  },
71
71
  "index.tsx": {
72
- "file": "assets/index-ByWTGseQ.js",
72
+ "file": "assets/index-UY6kXBX7.js",
73
73
  "name": "index",
74
74
  "src": "index.tsx",
75
75
  "isEntry": true,
@@ -1084,6 +1084,7 @@ import{G as g,j as o,cL as h,eo as v,ep as y,eq as x,l as r,c7 as z,er as a,r as
1084
1084
  font-optical-sizing: auto;
1085
1085
  font-weight: 400;
1086
1086
  font-style: normal;
1087
+ color: var(--ac-global-text-color-900);
1087
1088
  }
1088
1089
  .ac-theme {
1089
1090
  color: var(--ac-global-text-color-900);
phoenix/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "11.15.0"
1
+ __version__ = "11.16.1"