arize-phoenix 4.0.1__py3-none-any.whl → 4.0.3__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.3
2
2
  Name: arize-phoenix
3
- Version: 4.0.1
3
+ Version: 4.0.3
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
@@ -5,7 +5,7 @@ phoenix/exceptions.py,sha256=n2L2KKuecrdflB9MsCdAYCiSEvGJptIsfRkXMoJle7A,169
5
5
  phoenix/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
6
6
  phoenix/services.py,sha256=haZUWKuxfI5lm0o61HgW_4B6RTBg9CUbXC8y92ZMsw4,5121
7
7
  phoenix/settings.py,sha256=cO-qgis_S27nHirTobYI9hHPfZH18R--WMmxNdsVUwc,273
8
- phoenix/version.py,sha256=v4mcX8QEz7plObRyvTdDblE04TUjya-nJkDSAikxv9Y,22
8
+ phoenix/version.py,sha256=5zeiuQJN6kh6ruLu8rUR2scjLw-LXunQn0VwgH2RhjE,22
9
9
  phoenix/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  phoenix/core/embedding_dimension.py,sha256=zKGbcvwOXgLf-yrJBpQyKtd-LEOPRKHnUToyAU8Owis,87
11
11
  phoenix/core/model.py,sha256=SBO8BZg_CeQuH5LrSgzlQfqMModzirkQePdhnbLw7dE,4756
@@ -14,7 +14,7 @@ phoenix/core/model_schema_adapter.py,sha256=aFvNtpI01sdaLoKvEvcsx51vP5_6anP0_g9i
14
14
  phoenix/db/README.md,sha256=yM2HQcKBkhnAfbRMmMN5CyTIJs8Vj1Iiw4AENz2Ldz8,592
15
15
  phoenix/db/__init__.py,sha256=pDjEFXukHmJBM-1D8RjmXkvLsz85YWNxMQczt81ec3A,118
16
16
  phoenix/db/alembic.ini,sha256=p8DjVqGUs_tTx8oU56JP7qj-rMUebNFizItUSv_hPhs,3763
17
- phoenix/db/bulk_inserter.py,sha256=ad8-a_V0zSQjk2z7ZGnp8YO0B2cm6pLpHXI08IPPYEE,9655
17
+ phoenix/db/bulk_inserter.py,sha256=jubepj2a40jFy95NB8UFznpkFnlRRwB-iOXZ6DS0au8,9493
18
18
  phoenix/db/engines.py,sha256=vLWaZlToMtDI7rJDxSidYkfOoojamxaZxaz8ND3zTus,4770
19
19
  phoenix/db/helpers.py,sha256=L2_jP1iIWpUREhKLYYb4_vf_6v_BiU1E73Z2PczGm6s,1589
20
20
  phoenix/db/migrate.py,sha256=Rd7rnmYLFlSGO3R3rSzXCCvDkYkhxguqDbQNhI6rm5o,2251
@@ -161,7 +161,7 @@ phoenix/trace/schemas.py,sha256=JiFKhGD2JF6Eai7UOhPF5urcuKGkpMLHc3Vltbe1msk,5967
161
161
  phoenix/trace/span_evaluations.py,sha256=7DI1EFfpZoOH8iIUYNzL9P6U9j0Hc2Z3u2SD0h1SF_Q,13101
162
162
  phoenix/trace/span_json_decoder.py,sha256=IAFakPRqSMYxTPKYFMiXYxm7U-FipdN8_xbvapDS0Qc,3131
163
163
  phoenix/trace/span_json_encoder.py,sha256=tzSCIQJbeFBm33K68G8A5M12n_86tCDyuU0WAobxEz4,2010
164
- phoenix/trace/trace_dataset.py,sha256=RpHIfZLbMmULOIb-fKXJkQLhIdC0sJlAOTjlyJppMYA,13776
164
+ phoenix/trace/trace_dataset.py,sha256=197ey31Zp40eN_gH1YVGM7avkZs-YlROSKG3M5eZsWg,13830
165
165
  phoenix/trace/utils.py,sha256=7LurVGXn245cjj4MJsc7v6jq4DSJkpK6YGBfIaSywuw,1307
166
166
  phoenix/trace/dsl/README.md,sha256=ihmP9zGUC5V-TDbzKla76LuyDqPDQIBUH2BORwxNI68,2902
167
167
  phoenix/trace/dsl/__init__.py,sha256=WIQIjJg362XD3s50OsPJJ0xbDsGp41bSv7vDllLrPuA,144
@@ -183,8 +183,8 @@ phoenix/utilities/error_handling.py,sha256=7b5rpGFj9EWZ8yrZK1IHvxB89suWk3lggDayU
183
183
  phoenix/utilities/logging.py,sha256=lDXd6EGaamBNcQxL4vP1au9-i_SXe0OraUDiJOcszSw,222
184
184
  phoenix/utilities/project.py,sha256=qWsvKnG1oKhOFUowXf9qiOL2ia7jaFe_ijFFHEt8GJo,431
185
185
  phoenix/utilities/span_store.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
186
- arize_phoenix-4.0.1.dist-info/METADATA,sha256=9zMW_kCjqpQuYBy192t-6OqiE61ZJ3rQ9a0bxwLkwH8,30464
187
- arize_phoenix-4.0.1.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
188
- arize_phoenix-4.0.1.dist-info/licenses/IP_NOTICE,sha256=JBqyyCYYxGDfzQ0TtsQgjts41IJoa-hiwDrBjCb9gHM,469
189
- arize_phoenix-4.0.1.dist-info/licenses/LICENSE,sha256=HFkW9REuMOkvKRACuwLPT0hRydHb3zNg-fdFt94td18,3794
190
- arize_phoenix-4.0.1.dist-info/RECORD,,
186
+ arize_phoenix-4.0.3.dist-info/METADATA,sha256=iwmTF1Om7qivbRvMNDbQjf13vMMk5MfJTXfY6ODmWn8,30464
187
+ arize_phoenix-4.0.3.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
188
+ arize_phoenix-4.0.3.dist-info/licenses/IP_NOTICE,sha256=JBqyyCYYxGDfzQ0TtsQgjts41IJoa-hiwDrBjCb9gHM,469
189
+ arize_phoenix-4.0.3.dist-info/licenses/LICENSE,sha256=HFkW9REuMOkvKRACuwLPT0hRydHb3zNg-fdFt94td18,3794
190
+ arize_phoenix-4.0.3.dist-info/RECORD,,
@@ -3,7 +3,7 @@ import logging
3
3
  from dataclasses import dataclass, field
4
4
  from datetime import datetime, timezone
5
5
  from itertools import islice
6
- from time import perf_counter, time
6
+ from time import perf_counter
7
7
  from typing import (
8
8
  Any,
9
9
  AsyncContextManager,
@@ -48,21 +48,20 @@ class BulkInserter:
48
48
  cache_for_dataloaders: Optional[CacheForDataLoaders] = None,
49
49
  initial_batch_of_spans: Optional[Iterable[Tuple[Span, str]]] = None,
50
50
  initial_batch_of_evaluations: Optional[Iterable[pb.Evaluation]] = None,
51
- run_interval_in_seconds: float = 2,
51
+ sleep: float = 0.1,
52
52
  max_num_per_transaction: int = 1000,
53
53
  enable_prometheus: bool = False,
54
54
  ) -> None:
55
55
  """
56
56
  :param db: A function to initiate a new database session.
57
57
  :param initial_batch_of_spans: Initial batch of spans to insert.
58
- :param run_interval_in_seconds: The time interval between the starts of each
59
- bulk insert. If there's nothing to insert, the inserter goes back to sleep.
58
+ :param sleep: The time to sleep between bulk insertions
60
59
  :param max_num_per_transaction: The maximum number of items to insert in a single
61
60
  transaction. Multiple transactions will be used if there are more items in the batch.
62
61
  """
63
62
  self._db = db
64
63
  self._running = False
65
- self._run_interval_seconds = run_interval_in_seconds
64
+ self._sleep = sleep
66
65
  self._max_num_per_transaction = max_num_per_transaction
67
66
  self._spans: List[Tuple[Span, str]] = (
68
67
  [] if initial_batch_of_spans is None else list(initial_batch_of_spans)
@@ -98,11 +97,10 @@ class BulkInserter:
98
97
 
99
98
  async def _bulk_insert(self) -> None:
100
99
  spans_buffer, evaluations_buffer = None, None
101
- next_run_at = time() + self._run_interval_seconds
100
+ # start first insert immediately if the inserter has not run recently
102
101
  while self._spans or self._evaluations or self._running:
103
- await asyncio.sleep(next_run_at - time())
104
- next_run_at = time() + self._run_interval_seconds
105
102
  if not (self._spans or self._evaluations):
103
+ await asyncio.sleep(self._sleep)
106
104
  continue
107
105
  # It's important to grab the buffers at the same time so there's
108
106
  # no race condition, since an eval insertion will fail if the span
@@ -128,6 +126,7 @@ class BulkInserter:
128
126
  evaluations_buffer = None
129
127
  for project_rowid in transaction_result.updated_project_rowids:
130
128
  self._last_updated_at_by_project[project_rowid] = datetime.now(timezone.utc)
129
+ await asyncio.sleep(self._sleep)
131
130
 
132
131
  async def _insert_spans(self, spans: List[Tuple[Span, str]]) -> TransactionResult:
133
132
  transaction_result = TransactionResult()
@@ -16,6 +16,7 @@ from pyarrow import Schema, Table, parquet
16
16
 
17
17
  from phoenix.config import DATASET_DIR, GENERATED_DATASET_NAME_PREFIX, TRACE_DATASET_DIR
18
18
  from phoenix.datetime_utils import normalize_timestamps
19
+ from phoenix.trace.attributes import unflatten
19
20
  from phoenix.trace.errors import InvalidParquetMetadataError
20
21
  from phoenix.trace.schemas import ATTRIBUTE_PREFIX, CONTEXT_PREFIX, Span
21
22
  from phoenix.trace.span_evaluations import Evaluations, SpanEvaluations
@@ -161,13 +162,13 @@ class TraceDataset:
161
162
  for _, row in self.dataframe.iterrows():
162
163
  is_attribute = row.index.str.startswith(ATTRIBUTE_PREFIX)
163
164
  attribute_keys = row.index[is_attribute]
164
- attributes = (
165
+ attributes = unflatten(
165
166
  row.loc[is_attribute]
166
167
  .rename(
167
168
  {key: key[len(ATTRIBUTE_PREFIX) :] for key in attribute_keys},
168
169
  )
169
170
  .dropna()
170
- .to_dict()
171
+ .items()
171
172
  )
172
173
  is_context = row.index.str.startswith(CONTEXT_PREFIX)
173
174
  context_keys = row.index[is_context]
phoenix/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "4.0.1"
1
+ __version__ = "4.0.3"