arize-phoenix 5.5.2__py3-none-any.whl → 5.6.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-5.5.2.dist-info → arize_phoenix-5.6.0.dist-info}/METADATA +3 -6
- {arize_phoenix-5.5.2.dist-info → arize_phoenix-5.6.0.dist-info}/RECORD +171 -171
- phoenix/config.py +8 -8
- phoenix/core/model.py +3 -3
- phoenix/core/model_schema.py +41 -50
- phoenix/core/model_schema_adapter.py +17 -16
- phoenix/datetime_utils.py +2 -2
- phoenix/db/bulk_inserter.py +10 -20
- phoenix/db/engines.py +2 -1
- phoenix/db/enums.py +2 -2
- phoenix/db/helpers.py +8 -7
- phoenix/db/insertion/dataset.py +9 -19
- phoenix/db/insertion/document_annotation.py +14 -13
- phoenix/db/insertion/helpers.py +6 -16
- phoenix/db/insertion/span_annotation.py +14 -13
- phoenix/db/insertion/trace_annotation.py +14 -13
- phoenix/db/insertion/types.py +19 -30
- phoenix/db/migrations/versions/3be8647b87d8_add_token_columns_to_spans_table.py +8 -8
- phoenix/db/models.py +28 -28
- phoenix/experiments/evaluators/base.py +2 -1
- phoenix/experiments/evaluators/code_evaluators.py +4 -5
- phoenix/experiments/evaluators/llm_evaluators.py +157 -4
- phoenix/experiments/evaluators/utils.py +3 -2
- phoenix/experiments/functions.py +10 -21
- phoenix/experiments/tracing.py +2 -1
- phoenix/experiments/types.py +20 -29
- phoenix/experiments/utils.py +2 -1
- phoenix/inferences/errors.py +6 -5
- phoenix/inferences/fixtures.py +6 -5
- phoenix/inferences/inferences.py +37 -37
- phoenix/inferences/schema.py +11 -10
- phoenix/inferences/validation.py +13 -14
- phoenix/logging/_formatter.py +3 -3
- phoenix/metrics/__init__.py +5 -4
- phoenix/metrics/binning.py +2 -1
- phoenix/metrics/metrics.py +2 -1
- phoenix/metrics/mixins.py +7 -6
- phoenix/metrics/retrieval_metrics.py +2 -1
- phoenix/metrics/timeseries.py +5 -4
- phoenix/metrics/wrappers.py +2 -2
- phoenix/pointcloud/clustering.py +3 -4
- phoenix/pointcloud/pointcloud.py +7 -5
- phoenix/pointcloud/umap_parameters.py +2 -1
- phoenix/server/api/dataloaders/annotation_summaries.py +12 -19
- phoenix/server/api/dataloaders/average_experiment_run_latency.py +2 -2
- phoenix/server/api/dataloaders/cache/two_tier_cache.py +3 -2
- phoenix/server/api/dataloaders/dataset_example_revisions.py +3 -8
- phoenix/server/api/dataloaders/dataset_example_spans.py +2 -5
- phoenix/server/api/dataloaders/document_evaluation_summaries.py +12 -18
- phoenix/server/api/dataloaders/document_evaluations.py +3 -7
- phoenix/server/api/dataloaders/document_retrieval_metrics.py +6 -13
- phoenix/server/api/dataloaders/experiment_annotation_summaries.py +4 -8
- phoenix/server/api/dataloaders/experiment_error_rates.py +2 -5
- phoenix/server/api/dataloaders/experiment_run_annotations.py +3 -7
- phoenix/server/api/dataloaders/experiment_run_counts.py +1 -5
- phoenix/server/api/dataloaders/experiment_sequence_number.py +2 -5
- phoenix/server/api/dataloaders/latency_ms_quantile.py +21 -30
- phoenix/server/api/dataloaders/min_start_or_max_end_times.py +7 -13
- phoenix/server/api/dataloaders/project_by_name.py +3 -3
- phoenix/server/api/dataloaders/record_counts.py +11 -18
- phoenix/server/api/dataloaders/span_annotations.py +3 -7
- phoenix/server/api/dataloaders/span_dataset_examples.py +3 -8
- phoenix/server/api/dataloaders/span_descendants.py +3 -7
- phoenix/server/api/dataloaders/span_projects.py +2 -2
- phoenix/server/api/dataloaders/token_counts.py +12 -19
- phoenix/server/api/dataloaders/trace_row_ids.py +3 -7
- phoenix/server/api/dataloaders/user_roles.py +3 -3
- phoenix/server/api/dataloaders/users.py +3 -3
- phoenix/server/api/helpers/__init__.py +4 -3
- phoenix/server/api/helpers/dataset_helpers.py +10 -9
- phoenix/server/api/input_types/AddExamplesToDatasetInput.py +2 -2
- phoenix/server/api/input_types/AddSpansToDatasetInput.py +2 -2
- phoenix/server/api/input_types/ChatCompletionMessageInput.py +13 -1
- phoenix/server/api/input_types/ClusterInput.py +2 -2
- phoenix/server/api/input_types/DeleteAnnotationsInput.py +1 -3
- phoenix/server/api/input_types/DeleteDatasetExamplesInput.py +2 -2
- phoenix/server/api/input_types/DeleteExperimentsInput.py +1 -3
- phoenix/server/api/input_types/DimensionFilter.py +4 -4
- phoenix/server/api/input_types/Granularity.py +1 -1
- phoenix/server/api/input_types/InvocationParameters.py +2 -2
- phoenix/server/api/input_types/PatchDatasetExamplesInput.py +2 -2
- phoenix/server/api/mutations/dataset_mutations.py +4 -4
- phoenix/server/api/mutations/experiment_mutations.py +1 -2
- phoenix/server/api/mutations/export_events_mutations.py +7 -7
- phoenix/server/api/mutations/span_annotations_mutations.py +4 -4
- phoenix/server/api/mutations/trace_annotations_mutations.py +4 -4
- phoenix/server/api/mutations/user_mutations.py +4 -4
- phoenix/server/api/openapi/schema.py +2 -2
- phoenix/server/api/queries.py +20 -20
- phoenix/server/api/routers/oauth2.py +4 -4
- phoenix/server/api/routers/v1/datasets.py +22 -36
- phoenix/server/api/routers/v1/evaluations.py +6 -5
- phoenix/server/api/routers/v1/experiment_evaluations.py +2 -2
- phoenix/server/api/routers/v1/experiment_runs.py +2 -2
- phoenix/server/api/routers/v1/experiments.py +4 -4
- phoenix/server/api/routers/v1/spans.py +13 -12
- phoenix/server/api/routers/v1/traces.py +5 -5
- phoenix/server/api/routers/v1/utils.py +5 -5
- phoenix/server/api/subscriptions.py +284 -162
- phoenix/server/api/types/AnnotationSummary.py +3 -3
- phoenix/server/api/types/Cluster.py +8 -7
- phoenix/server/api/types/Dataset.py +5 -4
- phoenix/server/api/types/Dimension.py +3 -3
- phoenix/server/api/types/DocumentEvaluationSummary.py +8 -7
- phoenix/server/api/types/EmbeddingDimension.py +6 -5
- phoenix/server/api/types/EvaluationSummary.py +3 -3
- phoenix/server/api/types/Event.py +7 -7
- phoenix/server/api/types/Experiment.py +3 -3
- phoenix/server/api/types/ExperimentComparison.py +2 -4
- phoenix/server/api/types/Inferences.py +9 -8
- phoenix/server/api/types/InferencesRole.py +2 -2
- phoenix/server/api/types/Model.py +2 -2
- phoenix/server/api/types/Project.py +11 -18
- phoenix/server/api/types/Segments.py +3 -3
- phoenix/server/api/types/Span.py +8 -7
- phoenix/server/api/types/TimeSeries.py +8 -7
- phoenix/server/api/types/Trace.py +2 -2
- phoenix/server/api/types/UMAPPoints.py +6 -6
- phoenix/server/api/types/User.py +3 -3
- phoenix/server/api/types/node.py +1 -3
- phoenix/server/api/types/pagination.py +4 -4
- phoenix/server/api/utils.py +2 -4
- phoenix/server/app.py +16 -25
- phoenix/server/bearer_auth.py +4 -10
- phoenix/server/dml_event.py +3 -3
- phoenix/server/dml_event_handler.py +10 -24
- phoenix/server/grpc_server.py +3 -2
- phoenix/server/jwt_store.py +22 -21
- phoenix/server/main.py +3 -3
- phoenix/server/oauth2.py +3 -2
- phoenix/server/rate_limiters.py +5 -8
- phoenix/server/static/.vite/manifest.json +31 -31
- phoenix/server/static/assets/components-C70HJiXz.js +1612 -0
- phoenix/server/static/assets/{index-DCzakdJq.js → index-DLe1Oo3l.js} +2 -2
- phoenix/server/static/assets/{pages-CAL1FDMt.js → pages-C8-Sl7JI.js} +269 -434
- phoenix/server/static/assets/{vendor-6IcPAw_j.js → vendor-CtqfhlbC.js} +6 -6
- phoenix/server/static/assets/{vendor-arizeai-DRZuoyuF.js → vendor-arizeai-C_3SBz56.js} +2 -2
- phoenix/server/static/assets/{vendor-codemirror-DVE2_WBr.js → vendor-codemirror-wfdk9cjp.js} +1 -1
- phoenix/server/static/assets/{vendor-recharts-DwrexFA4.js → vendor-recharts-BiVnSv90.js} +1 -1
- phoenix/server/thread_server.py +1 -1
- phoenix/server/types.py +17 -29
- phoenix/services.py +4 -3
- phoenix/session/client.py +12 -24
- phoenix/session/data_extractor.py +3 -3
- phoenix/session/evaluation.py +1 -2
- phoenix/session/session.py +11 -20
- phoenix/trace/attributes.py +16 -28
- phoenix/trace/dsl/filter.py +17 -21
- phoenix/trace/dsl/helpers.py +3 -3
- phoenix/trace/dsl/query.py +13 -22
- phoenix/trace/fixtures.py +11 -17
- phoenix/trace/otel.py +5 -15
- phoenix/trace/projects.py +3 -2
- phoenix/trace/schemas.py +2 -2
- phoenix/trace/span_evaluations.py +9 -8
- phoenix/trace/span_json_decoder.py +3 -3
- phoenix/trace/span_json_encoder.py +2 -2
- phoenix/trace/trace_dataset.py +6 -5
- phoenix/trace/utils.py +6 -6
- phoenix/utilities/deprecation.py +3 -2
- phoenix/utilities/error_handling.py +3 -2
- phoenix/utilities/json.py +2 -1
- phoenix/utilities/logging.py +2 -2
- phoenix/utilities/project.py +1 -1
- phoenix/utilities/re.py +3 -4
- phoenix/utilities/template_formatters.py +5 -4
- phoenix/version.py +1 -1
- phoenix/server/static/assets/components-hX0LgYz3.js +0 -1428
- {arize_phoenix-5.5.2.dist-info → arize_phoenix-5.6.0.dist-info}/WHEEL +0 -0
- {arize_phoenix-5.5.2.dist-info → arize_phoenix-5.6.0.dist-info}/entry_points.txt +0 -0
- {arize_phoenix-5.5.2.dist-info → arize_phoenix-5.6.0.dist-info}/licenses/IP_NOTICE +0 -0
- {arize_phoenix-5.5.2.dist-info → arize_phoenix-5.6.0.dist-info}/licenses/LICENSE +0 -0
phoenix/trace/schemas.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
from enum import Enum
|
|
4
|
-
from typing import Any,
|
|
4
|
+
from typing import Any, Mapping, NamedTuple, Optional
|
|
5
5
|
from uuid import UUID
|
|
6
6
|
|
|
7
7
|
EXCEPTION_TYPE = "exception.type"
|
|
@@ -169,7 +169,7 @@ class Span:
|
|
|
169
169
|
OpenTelemetry Inspiration:
|
|
170
170
|
https://opentelemetry.io/docs/concepts/signals/traces/#span-events
|
|
171
171
|
"""
|
|
172
|
-
events:
|
|
172
|
+
events: list[SpanEvent]
|
|
173
173
|
|
|
174
174
|
"""
|
|
175
175
|
An extension of the OpenTelemetry Span interface to include the
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from abc import ABC
|
|
3
|
+
from collections.abc import Callable, Mapping, Sequence
|
|
3
4
|
from dataclasses import dataclass, field
|
|
4
5
|
from itertools import product
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
from types import MappingProxyType
|
|
7
|
-
from typing import Any,
|
|
8
|
+
from typing import Any, Optional, Union
|
|
8
9
|
from uuid import UUID, uuid4
|
|
9
10
|
|
|
10
11
|
import pandas as pd
|
|
@@ -20,11 +21,11 @@ EVAL_PARQUET_FILE_NAME = "evaluations-{id}.parquet"
|
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
class NeedsNamedIndex(ABC):
|
|
23
|
-
index_names: Mapping[
|
|
24
|
-
all_valid_index_name_sorted_combos:
|
|
24
|
+
index_names: Mapping[tuple[str, ...], Callable[[Any], bool]]
|
|
25
|
+
all_valid_index_name_sorted_combos: set[tuple[str, ...]]
|
|
25
26
|
|
|
26
27
|
@classmethod
|
|
27
|
-
def preferred_names(cls) ->
|
|
28
|
+
def preferred_names(cls) -> list[str]:
|
|
28
29
|
return [choices[0] for choices in cls.index_names.keys()]
|
|
29
30
|
|
|
30
31
|
@classmethod
|
|
@@ -43,7 +44,7 @@ class NeedsNamedIndex(ABC):
|
|
|
43
44
|
)
|
|
44
45
|
|
|
45
46
|
@classmethod
|
|
46
|
-
def find_valid_index_names(cls, dtypes: "pd.Series[Any]") -> Optional[
|
|
47
|
+
def find_valid_index_names(cls, dtypes: "pd.Series[Any]") -> Optional[list[str]]:
|
|
47
48
|
valid_names = []
|
|
48
49
|
for names, check_type in cls.index_names.items():
|
|
49
50
|
for name in names:
|
|
@@ -92,7 +93,7 @@ class Evaluations(NeedsNamedIndex, NeedsResultColumns, ABC):
|
|
|
92
93
|
f"dataframe=<rows: {len(self.dataframe)!r}>)"
|
|
93
94
|
)
|
|
94
95
|
|
|
95
|
-
def __dir__(self) ->
|
|
96
|
+
def __dir__(self) -> list[str]:
|
|
96
97
|
return ["get_dataframe"]
|
|
97
98
|
|
|
98
99
|
def get_dataframe(self, prefix_columns_with_name: bool = True) -> pd.DataFrame:
|
|
@@ -153,7 +154,7 @@ class Evaluations(NeedsNamedIndex, NeedsResultColumns, ABC):
|
|
|
153
154
|
|
|
154
155
|
def __init_subclass__(
|
|
155
156
|
cls,
|
|
156
|
-
index_names: Mapping[
|
|
157
|
+
index_names: Mapping[tuple[str, ...], Callable[[Any], bool]],
|
|
157
158
|
**kwargs: Any,
|
|
158
159
|
) -> None:
|
|
159
160
|
super().__init_subclass__(**kwargs)
|
|
@@ -327,7 +328,7 @@ class TraceEvaluations(
|
|
|
327
328
|
): ...
|
|
328
329
|
|
|
329
330
|
|
|
330
|
-
def _parse_schema_metadata(schema: Schema) ->
|
|
331
|
+
def _parse_schema_metadata(schema: Schema) -> tuple[UUID, str, type[Evaluations]]:
|
|
331
332
|
"""
|
|
332
333
|
Validates and parses the pyarrow schema metadata.
|
|
333
334
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from datetime import datetime
|
|
3
|
-
from typing import Any,
|
|
3
|
+
from typing import Any, Optional
|
|
4
4
|
|
|
5
5
|
from openinference.semconv.trace import SpanAttributes
|
|
6
6
|
|
|
@@ -22,7 +22,7 @@ INPUT_MIME_TYPE = SpanAttributes.INPUT_MIME_TYPE
|
|
|
22
22
|
OUTPUT_MIME_TYPE = SpanAttributes.OUTPUT_MIME_TYPE
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
def json_to_attributes(obj: Optional[
|
|
25
|
+
def json_to_attributes(obj: Optional[dict[str, Any]]) -> dict[str, Any]:
|
|
26
26
|
if obj is None:
|
|
27
27
|
return {}
|
|
28
28
|
if not isinstance(obj, dict):
|
|
@@ -34,7 +34,7 @@ def json_to_attributes(obj: Optional[Dict[str, Any]]) -> Dict[str, Any]:
|
|
|
34
34
|
return obj
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
def json_to_span(data:
|
|
37
|
+
def json_to_span(data: dict[str, Any]) -> Any:
|
|
38
38
|
"""
|
|
39
39
|
A hook for json.loads to convert a dict to a Span object.
|
|
40
40
|
"""
|
|
@@ -2,7 +2,7 @@ import json
|
|
|
2
2
|
from dataclasses import asdict
|
|
3
3
|
from datetime import datetime
|
|
4
4
|
from enum import Enum
|
|
5
|
-
from typing import Any
|
|
5
|
+
from typing import Any
|
|
6
6
|
from uuid import UUID
|
|
7
7
|
|
|
8
8
|
import numpy as np
|
|
@@ -60,5 +60,5 @@ def span_to_json(span: Span) -> str:
|
|
|
60
60
|
return json.dumps(span, cls=SpanJSONEncoder)
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
def spans_to_jsonl(spans:
|
|
63
|
+
def spans_to_jsonl(spans: list[Span]) -> str:
|
|
64
64
|
return "\n".join(span_to_json(span) for span in spans)
|
phoenix/trace/trace_dataset.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import json
|
|
2
|
+
from collections.abc import Iterable, Iterator
|
|
2
3
|
from datetime import datetime
|
|
3
4
|
from pathlib import Path
|
|
4
|
-
from typing import Any,
|
|
5
|
+
from typing import Any, Optional, Union, cast
|
|
5
6
|
from uuid import UUID, uuid4
|
|
6
7
|
from warnings import warn
|
|
7
8
|
|
|
@@ -116,7 +117,7 @@ class TraceDataset:
|
|
|
116
117
|
A human readable name for the dataset.
|
|
117
118
|
"""
|
|
118
119
|
dataframe: pd.DataFrame
|
|
119
|
-
evaluations:
|
|
120
|
+
evaluations: list[Evaluations] = []
|
|
120
121
|
_id: UUID
|
|
121
122
|
_data_file_name: str = "data.parquet"
|
|
122
123
|
|
|
@@ -152,11 +153,11 @@ class TraceDataset:
|
|
|
152
153
|
self.evaluations = list(evaluations)
|
|
153
154
|
|
|
154
155
|
@classmethod
|
|
155
|
-
def from_spans(cls, spans:
|
|
156
|
+
def from_spans(cls, spans: list[Span]) -> "TraceDataset":
|
|
156
157
|
"""Creates a TraceDataset from a list of spans.
|
|
157
158
|
|
|
158
159
|
Args:
|
|
159
|
-
spans (
|
|
160
|
+
spans (list[Span]): A list of spans.
|
|
160
161
|
|
|
161
162
|
Returns:
|
|
162
163
|
TraceDataset: A TraceDataset containing the spans.
|
|
@@ -349,7 +350,7 @@ class TraceDataset:
|
|
|
349
350
|
return pd.concat([df, evals_df], axis=1)
|
|
350
351
|
|
|
351
352
|
|
|
352
|
-
def _parse_schema_metadata(schema: Schema) ->
|
|
353
|
+
def _parse_schema_metadata(schema: Schema) -> tuple[UUID, str, list[UUID]]:
|
|
353
354
|
"""
|
|
354
355
|
Returns parsed metadata from a parquet schema or raises an exception if the
|
|
355
356
|
metadata is invalid.
|
phoenix/trace/utils.py
CHANGED
|
@@ -2,7 +2,7 @@ import json
|
|
|
2
2
|
import os
|
|
3
3
|
import re
|
|
4
4
|
from traceback import format_exception
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Optional, cast
|
|
6
6
|
from urllib import request
|
|
7
7
|
|
|
8
8
|
import pandas as pd
|
|
@@ -14,16 +14,16 @@ def parse_file_extension(file_path: str) -> str:
|
|
|
14
14
|
|
|
15
15
|
def download_json_traces_fixture(
|
|
16
16
|
url: str,
|
|
17
|
-
) ->
|
|
17
|
+
) -> list[str]:
|
|
18
18
|
"""
|
|
19
19
|
Stores the traces fixture as list of jsons from the jsonl files in the phoenix bucket.
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
22
|
with request.urlopen(url) as f:
|
|
23
|
-
return cast(
|
|
23
|
+
return cast(list[str], f.readlines())
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
def json_lines_to_df(lines:
|
|
26
|
+
def json_lines_to_df(lines: list[str]) -> pd.DataFrame:
|
|
27
27
|
"""
|
|
28
28
|
Convert a list of JSON line strings to a Pandas DataFrame.
|
|
29
29
|
"""
|
|
@@ -56,9 +56,9 @@ def get_stacktrace(exception: BaseException) -> str:
|
|
|
56
56
|
_VERSION_TRIPLET_REGEX = re.compile(r"(\d+)\.(\d+)\.(\d+)")
|
|
57
57
|
|
|
58
58
|
|
|
59
|
-
def extract_version_triplet(version: str) -> Optional[
|
|
59
|
+
def extract_version_triplet(version: str) -> Optional[tuple[int, int, int]]:
|
|
60
60
|
return (
|
|
61
|
-
cast(
|
|
61
|
+
cast(tuple[int, int, int], tuple(map(int, match.groups())))
|
|
62
62
|
if (match := _VERSION_TRIPLET_REGEX.search(version))
|
|
63
63
|
else None
|
|
64
64
|
)
|
phoenix/utilities/deprecation.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import functools
|
|
2
2
|
import warnings
|
|
3
|
-
from
|
|
3
|
+
from collections.abc import Callable
|
|
4
|
+
from typing import Any, TypeVar
|
|
4
5
|
|
|
5
|
-
GenericClass = TypeVar("GenericClass", bound=
|
|
6
|
+
GenericClass = TypeVar("GenericClass", bound=type[Any])
|
|
6
7
|
CallableType = TypeVar("CallableType", bound=Callable[..., Any])
|
|
7
8
|
|
|
8
9
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import traceback
|
|
3
|
-
from
|
|
3
|
+
from collections.abc import Callable, Iterable
|
|
4
|
+
from typing import Any, Optional, TypeVar, cast
|
|
4
5
|
|
|
5
6
|
F = TypeVar("F", bound=Callable[..., Any])
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def graceful_fallback(
|
|
9
|
-
fallback_method: Callable[..., Any], exceptions: Optional[Iterable[
|
|
10
|
+
fallback_method: Callable[..., Any], exceptions: Optional[Iterable[type[BaseException]]] = None
|
|
10
11
|
) -> Callable[[F], F]:
|
|
11
12
|
"""
|
|
12
13
|
Decorator that reroutes failing functions to a specified fallback method.
|
phoenix/utilities/json.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import dataclasses
|
|
2
2
|
import datetime
|
|
3
|
+
from collections.abc import Mapping, Sequence
|
|
3
4
|
from enum import Enum
|
|
4
5
|
from pathlib import Path
|
|
5
|
-
from typing import Any,
|
|
6
|
+
from typing import Any, Union, get_args, get_origin
|
|
6
7
|
|
|
7
8
|
import numpy as np
|
|
8
9
|
from strawberry import UNSET
|
phoenix/utilities/logging.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# A collection of printing and logging utilities
|
|
2
2
|
|
|
3
|
-
from typing import Any
|
|
3
|
+
from typing import Any
|
|
4
4
|
|
|
5
5
|
from tqdm.auto import tqdm
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ def printif(condition: bool, *args: Any, **kwargs: Any) -> None:
|
|
|
10
10
|
tqdm.write(*args, **kwargs)
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def log_a_list(list_of_str:
|
|
13
|
+
def log_a_list(list_of_str: list[str], join_word: str) -> str:
|
|
14
14
|
if list_of_str is None or len(list_of_str) == 0:
|
|
15
15
|
return ""
|
|
16
16
|
if len(list_of_str) == 1:
|
phoenix/utilities/project.py
CHANGED
phoenix/utilities/re.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from re import compile, split
|
|
3
|
-
from typing import Dict, List
|
|
4
3
|
from urllib.parse import unquote
|
|
5
4
|
|
|
6
5
|
logger = logging.getLogger(__name__)
|
|
@@ -19,7 +18,7 @@ _HEADER_PATTERN = compile(_KEY_VALUE_FORMAT)
|
|
|
19
18
|
_DELIMITER_PATTERN = compile(r"[ \t]*,[ \t]*")
|
|
20
19
|
|
|
21
20
|
|
|
22
|
-
def parse_env_headers(s: str) ->
|
|
21
|
+
def parse_env_headers(s: str) -> dict[str, str]:
|
|
23
22
|
"""
|
|
24
23
|
Parse ``s``, which is a ``str`` instance containing HTTP headers encoded
|
|
25
24
|
for use in ENV variables per the W3C Baggage HTTP header format at
|
|
@@ -28,8 +27,8 @@ def parse_env_headers(s: str) -> Dict[str, str]:
|
|
|
28
27
|
|
|
29
28
|
src: https://github.com/open-telemetry/opentelemetry-python/blob/2d5cd58f33bd8a16f45f30be620a96699bc14297/opentelemetry-api/src/opentelemetry/util/re.py#L52
|
|
30
29
|
"""
|
|
31
|
-
headers:
|
|
32
|
-
headers_list:
|
|
30
|
+
headers: dict[str, str] = {}
|
|
31
|
+
headers_list: list[str] = split(_DELIMITER_PATTERN, s)
|
|
33
32
|
for header in headers_list:
|
|
34
33
|
if not header: # empty string
|
|
35
34
|
continue
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import re
|
|
2
2
|
from abc import ABC, abstractmethod
|
|
3
|
+
from collections.abc import Iterable
|
|
3
4
|
from string import Formatter
|
|
4
|
-
from typing import Any
|
|
5
|
+
from typing import Any
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class TemplateFormatter(ABC):
|
|
8
9
|
@abstractmethod
|
|
9
|
-
def parse(self, template: str) ->
|
|
10
|
+
def parse(self, template: str) -> set[str]:
|
|
10
11
|
"""
|
|
11
12
|
Parse the template and return a set of variable names.
|
|
12
13
|
"""
|
|
@@ -37,7 +38,7 @@ class FStringTemplateFormatter(TemplateFormatter):
|
|
|
37
38
|
'world'
|
|
38
39
|
"""
|
|
39
40
|
|
|
40
|
-
def parse(self, template: str) ->
|
|
41
|
+
def parse(self, template: str) -> set[str]:
|
|
41
42
|
return set(field_name for _, field_name, _, _ in Formatter().parse(template) if field_name)
|
|
42
43
|
|
|
43
44
|
def _format(self, template: str, variable_names: Iterable[str], **variables: Any) -> str:
|
|
@@ -57,7 +58,7 @@ class MustacheTemplateFormatter(TemplateFormatter):
|
|
|
57
58
|
|
|
58
59
|
PATTERN = re.compile(r"(?<!\\){{\s*(\w+)\s*}}")
|
|
59
60
|
|
|
60
|
-
def parse(self, template: str) ->
|
|
61
|
+
def parse(self, template: str) -> set[str]:
|
|
61
62
|
return set(match for match in re.findall(self.PATTERN, template))
|
|
62
63
|
|
|
63
64
|
def _format(self, template: str, variable_names: Iterable[str], **variables: Any) -> str:
|
phoenix/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "5.
|
|
1
|
+
__version__ = "5.6.0"
|