arize 8.0.0b0__py3-none-any.whl → 8.0.0b2__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.
- arize/__init__.py +1 -1
- arize/_client_factory.py +50 -0
- arize/_flight/client.py +4 -4
- arize/_generated/api_client/__init__.py +0 -2
- arize/_generated/api_client/api/datasets_api.py +6 -6
- arize/_generated/api_client/api/experiments_api.py +6 -6
- arize/_generated/api_client/api/projects_api.py +3 -3
- arize/_generated/api_client/models/__init__.py +0 -1
- arize/_generated/api_client/models/datasets_create_request.py +2 -10
- arize/_generated/api_client/models/datasets_examples_insert_request.py +2 -10
- arize/_generated/api_client/test/test_datasets_create_request.py +2 -6
- arize/_generated/api_client/test/test_datasets_examples_insert_request.py +2 -6
- arize/_generated/api_client/test/test_datasets_examples_list200_response.py +2 -6
- arize/_generated/api_client/test/test_datasets_examples_update_request.py +2 -6
- arize/_generated/api_client/test/test_experiments_create_request.py +2 -6
- arize/_generated/api_client/test/test_experiments_runs_list200_response.py +2 -6
- arize/_generated/api_client_README.md +0 -1
- arize/_lazy.py +25 -9
- arize/client.py +16 -52
- arize/config.py +9 -36
- arize/constants/ml.py +9 -16
- arize/constants/spans.py +5 -10
- arize/datasets/client.py +13 -9
- arize/datasets/errors.py +1 -1
- arize/datasets/validation.py +2 -2
- arize/embeddings/auto_generator.py +2 -2
- arize/embeddings/errors.py +2 -2
- arize/embeddings/tabular_generators.py +1 -1
- arize/exceptions/base.py +0 -52
- arize/exceptions/parameters.py +0 -329
- arize/experiments/__init__.py +2 -2
- arize/experiments/client.py +16 -10
- arize/experiments/evaluators/base.py +6 -6
- arize/experiments/evaluators/executors.py +10 -3
- arize/experiments/evaluators/types.py +2 -2
- arize/experiments/functions.py +24 -17
- arize/experiments/types.py +6 -8
- arize/logging.py +1 -1
- arize/ml/batch_validation/errors.py +10 -1004
- arize/ml/batch_validation/validator.py +273 -225
- arize/ml/casting.py +7 -7
- arize/ml/client.py +12 -11
- arize/ml/proto.py +6 -6
- arize/ml/stream_validation.py +2 -3
- arize/ml/surrogate_explainer/mimic.py +3 -3
- arize/ml/types.py +1 -55
- arize/pre_releases.py +6 -3
- arize/projects/client.py +9 -4
- arize/regions.py +2 -2
- arize/spans/client.py +14 -12
- arize/spans/columns.py +32 -36
- arize/spans/conversion.py +5 -6
- arize/spans/validation/common/argument_validation.py +3 -3
- arize/spans/validation/common/dataframe_form_validation.py +6 -6
- arize/spans/validation/common/value_validation.py +1 -1
- arize/spans/validation/evals/dataframe_form_validation.py +4 -4
- arize/spans/validation/evals/evals_validation.py +6 -6
- arize/spans/validation/metadata/dataframe_form_validation.py +1 -1
- arize/spans/validation/spans/dataframe_form_validation.py +2 -2
- arize/spans/validation/spans/spans_validation.py +6 -6
- arize/utils/arrow.py +2 -2
- arize/utils/cache.py +2 -2
- arize/utils/dataframe.py +4 -4
- arize/utils/online_tasks/dataframe_preprocessor.py +7 -7
- arize/utils/openinference_conversion.py +10 -10
- arize/utils/proto.py +1 -1
- arize/version.py +1 -1
- {arize-8.0.0b0.dist-info → arize-8.0.0b2.dist-info}/METADATA +71 -63
- {arize-8.0.0b0.dist-info → arize-8.0.0b2.dist-info}/RECORD +72 -73
- arize/_generated/api_client/models/primitive_value.py +0 -172
- arize/_generated/api_client/test/test_primitive_value.py +0 -50
- {arize-8.0.0b0.dist-info → arize-8.0.0b2.dist-info}/WHEEL +0 -0
- {arize-8.0.0b0.dist-info → arize-8.0.0b2.dist-info}/licenses/LICENSE +0 -0
- {arize-8.0.0b0.dist-info → arize-8.0.0b2.dist-info}/licenses/NOTICE +0 -0
arize/__init__.py
CHANGED
|
@@ -37,7 +37,7 @@ def make_to_df(field_name: str) -> object:
|
|
|
37
37
|
json_normalize: bool = False,
|
|
38
38
|
convert_dtypes: bool = True,
|
|
39
39
|
) -> object:
|
|
40
|
-
"""Convert a list of objects to a pandas
|
|
40
|
+
"""Convert a list of objects to a :class:`pandas.DataFrame`.
|
|
41
41
|
|
|
42
42
|
Behavior:
|
|
43
43
|
- If an item is a Pydantic v2 model, use `.model_dump(by_alias=...)`.
|
arize/_client_factory.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Factory for creating and caching the generated OpenAPI client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import threading
|
|
6
|
+
from typing import TYPE_CHECKING
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from arize._generated.api_client.api_client import ApiClient
|
|
10
|
+
from arize.config import SDKConfiguration
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class GeneratedClientFactory:
|
|
14
|
+
"""Factory for creating and caching generated OpenAPI clients.
|
|
15
|
+
|
|
16
|
+
This factory is owned by ArizeClient and provides thread-safe lazy
|
|
17
|
+
initialization of the OpenAPI client used by various subclients.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __init__(self, sdk_config: SDKConfiguration) -> None:
|
|
21
|
+
"""Initialize the factory.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
sdk_config: SDK configuration containing API settings.
|
|
25
|
+
"""
|
|
26
|
+
self._sdk_config = sdk_config
|
|
27
|
+
self._client: ApiClient | None = None
|
|
28
|
+
self._lock = threading.Lock()
|
|
29
|
+
|
|
30
|
+
def get_client(self) -> ApiClient:
|
|
31
|
+
"""Get or create the generated OpenAPI client instance.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
The shared generated API client instance.
|
|
35
|
+
"""
|
|
36
|
+
if self._client is not None:
|
|
37
|
+
return self._client
|
|
38
|
+
|
|
39
|
+
with self._lock:
|
|
40
|
+
if self._client is not None:
|
|
41
|
+
return self._client
|
|
42
|
+
|
|
43
|
+
# Import lazily to avoid extra dependencies at config time
|
|
44
|
+
from arize._generated import api_client as gen
|
|
45
|
+
|
|
46
|
+
cfg = gen.Configuration(host=self._sdk_config.api_url)
|
|
47
|
+
if self._sdk_config.api_key:
|
|
48
|
+
cfg.access_token = self._sdk_config.api_key
|
|
49
|
+
self._client = gen.ApiClient(cfg)
|
|
50
|
+
return self._client
|
arize/_flight/client.py
CHANGED
|
@@ -333,8 +333,8 @@ class ArizeFlightClient:
|
|
|
333
333
|
latest version.
|
|
334
334
|
|
|
335
335
|
Returns:
|
|
336
|
-
A pandas DataFrame containing the dataset examples
|
|
337
|
-
|
|
336
|
+
:class:`pandas.DataFrame`: A pandas DataFrame containing the dataset examples
|
|
337
|
+
with JSON string columns converted to dict objects.
|
|
338
338
|
|
|
339
339
|
Raises:
|
|
340
340
|
RuntimeError: If the Flight request fails.
|
|
@@ -374,8 +374,8 @@ class ArizeFlightClient:
|
|
|
374
374
|
experiment_id: Experiment ID to retrieve runs from.
|
|
375
375
|
|
|
376
376
|
Returns:
|
|
377
|
-
A pandas DataFrame containing the experiment runs
|
|
378
|
-
|
|
377
|
+
:class:`pandas.DataFrame`: A pandas DataFrame containing the experiment runs
|
|
378
|
+
with JSON string columns converted to dict objects.
|
|
379
379
|
|
|
380
380
|
Raises:
|
|
381
381
|
RuntimeError: If the Flight request fails.
|
|
@@ -46,7 +46,6 @@ __all__ = [
|
|
|
46
46
|
"ExperimentsList200Response",
|
|
47
47
|
"ExperimentsRunsList200Response",
|
|
48
48
|
"PaginationMetadata",
|
|
49
|
-
"PrimitiveValue",
|
|
50
49
|
"Problem",
|
|
51
50
|
"Project",
|
|
52
51
|
"ProjectsCreateRequest",
|
|
@@ -86,7 +85,6 @@ from arize._generated.api_client.models.experiments_create_request import Experi
|
|
|
86
85
|
from arize._generated.api_client.models.experiments_list200_response import ExperimentsList200Response as ExperimentsList200Response
|
|
87
86
|
from arize._generated.api_client.models.experiments_runs_list200_response import ExperimentsRunsList200Response as ExperimentsRunsList200Response
|
|
88
87
|
from arize._generated.api_client.models.pagination_metadata import PaginationMetadata as PaginationMetadata
|
|
89
|
-
from arize._generated.api_client.models.primitive_value import PrimitiveValue as PrimitiveValue
|
|
90
88
|
from arize._generated.api_client.models.problem import Problem as Problem
|
|
91
89
|
from arize._generated.api_client.models.project import Project as Project
|
|
92
90
|
from arize._generated.api_client.models.projects_create_request import ProjectsCreateRequest as ProjectsCreateRequest
|
|
@@ -940,7 +940,7 @@ class DatasetsApi:
|
|
|
940
940
|
self,
|
|
941
941
|
dataset_id: Annotated[StrictStr, Field(description="The unique identifier of the dataset")],
|
|
942
942
|
dataset_version_id: Annotated[Optional[StrictStr], Field(description="The unique identifier of the dataset version")] = None,
|
|
943
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
943
|
+
limit: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
944
944
|
_request_timeout: Union[
|
|
945
945
|
None,
|
|
946
946
|
Annotated[StrictFloat, Field(gt=0)],
|
|
@@ -1021,7 +1021,7 @@ class DatasetsApi:
|
|
|
1021
1021
|
self,
|
|
1022
1022
|
dataset_id: Annotated[StrictStr, Field(description="The unique identifier of the dataset")],
|
|
1023
1023
|
dataset_version_id: Annotated[Optional[StrictStr], Field(description="The unique identifier of the dataset version")] = None,
|
|
1024
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
1024
|
+
limit: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
1025
1025
|
_request_timeout: Union[
|
|
1026
1026
|
None,
|
|
1027
1027
|
Annotated[StrictFloat, Field(gt=0)],
|
|
@@ -1102,7 +1102,7 @@ class DatasetsApi:
|
|
|
1102
1102
|
self,
|
|
1103
1103
|
dataset_id: Annotated[StrictStr, Field(description="The unique identifier of the dataset")],
|
|
1104
1104
|
dataset_version_id: Annotated[Optional[StrictStr], Field(description="The unique identifier of the dataset version")] = None,
|
|
1105
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
1105
|
+
limit: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
1106
1106
|
_request_timeout: Union[
|
|
1107
1107
|
None,
|
|
1108
1108
|
Annotated[StrictFloat, Field(gt=0)],
|
|
@@ -1861,7 +1861,7 @@ class DatasetsApi:
|
|
|
1861
1861
|
def datasets_list(
|
|
1862
1862
|
self,
|
|
1863
1863
|
space_id: Annotated[Optional[StrictStr], Field(description="Filter search results to a particular space ID")] = None,
|
|
1864
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
1864
|
+
limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
1865
1865
|
cursor: Annotated[Optional[StrictStr], Field(description="Opaque pagination cursor returned from a previous response (`pagination.next_cursor`). Treat it as an unreadable token; do not attempt to parse or construct it. ")] = None,
|
|
1866
1866
|
_request_timeout: Union[
|
|
1867
1867
|
None,
|
|
@@ -1941,7 +1941,7 @@ class DatasetsApi:
|
|
|
1941
1941
|
def datasets_list_with_http_info(
|
|
1942
1942
|
self,
|
|
1943
1943
|
space_id: Annotated[Optional[StrictStr], Field(description="Filter search results to a particular space ID")] = None,
|
|
1944
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
1944
|
+
limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
1945
1945
|
cursor: Annotated[Optional[StrictStr], Field(description="Opaque pagination cursor returned from a previous response (`pagination.next_cursor`). Treat it as an unreadable token; do not attempt to parse or construct it. ")] = None,
|
|
1946
1946
|
_request_timeout: Union[
|
|
1947
1947
|
None,
|
|
@@ -2021,7 +2021,7 @@ class DatasetsApi:
|
|
|
2021
2021
|
def datasets_list_without_preload_content(
|
|
2022
2022
|
self,
|
|
2023
2023
|
space_id: Annotated[Optional[StrictStr], Field(description="Filter search results to a particular space ID")] = None,
|
|
2024
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
2024
|
+
limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
2025
2025
|
cursor: Annotated[Optional[StrictStr], Field(description="Opaque pagination cursor returned from a previous response (`pagination.next_cursor`). Treat it as an unreadable token; do not attempt to parse or construct it. ")] = None,
|
|
2026
2026
|
_request_timeout: Union[
|
|
2027
2027
|
None,
|
|
@@ -898,7 +898,7 @@ class ExperimentsApi:
|
|
|
898
898
|
def experiments_list(
|
|
899
899
|
self,
|
|
900
900
|
dataset_id: Annotated[Optional[StrictStr], Field(description="Filter experiments to a particular dataset ID")] = None,
|
|
901
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
901
|
+
limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
902
902
|
cursor: Annotated[Optional[StrictStr], Field(description="Opaque pagination cursor returned from a previous response (`pagination.next_cursor`). Treat it as an unreadable token; do not attempt to parse or construct it. ")] = None,
|
|
903
903
|
_request_timeout: Union[
|
|
904
904
|
None,
|
|
@@ -978,7 +978,7 @@ class ExperimentsApi:
|
|
|
978
978
|
def experiments_list_with_http_info(
|
|
979
979
|
self,
|
|
980
980
|
dataset_id: Annotated[Optional[StrictStr], Field(description="Filter experiments to a particular dataset ID")] = None,
|
|
981
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
981
|
+
limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
982
982
|
cursor: Annotated[Optional[StrictStr], Field(description="Opaque pagination cursor returned from a previous response (`pagination.next_cursor`). Treat it as an unreadable token; do not attempt to parse or construct it. ")] = None,
|
|
983
983
|
_request_timeout: Union[
|
|
984
984
|
None,
|
|
@@ -1058,7 +1058,7 @@ class ExperimentsApi:
|
|
|
1058
1058
|
def experiments_list_without_preload_content(
|
|
1059
1059
|
self,
|
|
1060
1060
|
dataset_id: Annotated[Optional[StrictStr], Field(description="Filter experiments to a particular dataset ID")] = None,
|
|
1061
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
1061
|
+
limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
1062
1062
|
cursor: Annotated[Optional[StrictStr], Field(description="Opaque pagination cursor returned from a previous response (`pagination.next_cursor`). Treat it as an unreadable token; do not attempt to parse or construct it. ")] = None,
|
|
1063
1063
|
_request_timeout: Union[
|
|
1064
1064
|
None,
|
|
@@ -1211,7 +1211,7 @@ class ExperimentsApi:
|
|
|
1211
1211
|
def experiments_runs_list(
|
|
1212
1212
|
self,
|
|
1213
1213
|
experiment_id: Annotated[StrictStr, Field(description="The unique identifier of the experiment")],
|
|
1214
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
1214
|
+
limit: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
1215
1215
|
_request_timeout: Union[
|
|
1216
1216
|
None,
|
|
1217
1217
|
Annotated[StrictFloat, Field(gt=0)],
|
|
@@ -1288,7 +1288,7 @@ class ExperimentsApi:
|
|
|
1288
1288
|
def experiments_runs_list_with_http_info(
|
|
1289
1289
|
self,
|
|
1290
1290
|
experiment_id: Annotated[StrictStr, Field(description="The unique identifier of the experiment")],
|
|
1291
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
1291
|
+
limit: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
1292
1292
|
_request_timeout: Union[
|
|
1293
1293
|
None,
|
|
1294
1294
|
Annotated[StrictFloat, Field(gt=0)],
|
|
@@ -1365,7 +1365,7 @@ class ExperimentsApi:
|
|
|
1365
1365
|
def experiments_runs_list_without_preload_content(
|
|
1366
1366
|
self,
|
|
1367
1367
|
experiment_id: Annotated[StrictStr, Field(description="The unique identifier of the experiment")],
|
|
1368
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
1368
|
+
limit: Annotated[Optional[Annotated[int, Field(le=500, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
1369
1369
|
_request_timeout: Union[
|
|
1370
1370
|
None,
|
|
1371
1371
|
Annotated[StrictFloat, Field(gt=0)],
|
|
@@ -891,7 +891,7 @@ class ProjectsApi:
|
|
|
891
891
|
def projects_list(
|
|
892
892
|
self,
|
|
893
893
|
space_id: Annotated[Optional[StrictStr], Field(description="Filter search results to a particular space ID")] = None,
|
|
894
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
894
|
+
limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
895
895
|
cursor: Annotated[Optional[StrictStr], Field(description="Opaque pagination cursor returned from a previous response (`pagination.next_cursor`). Treat it as an unreadable token; do not attempt to parse or construct it. ")] = None,
|
|
896
896
|
_request_timeout: Union[
|
|
897
897
|
None,
|
|
@@ -970,7 +970,7 @@ class ProjectsApi:
|
|
|
970
970
|
def projects_list_with_http_info(
|
|
971
971
|
self,
|
|
972
972
|
space_id: Annotated[Optional[StrictStr], Field(description="Filter search results to a particular space ID")] = None,
|
|
973
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
973
|
+
limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
974
974
|
cursor: Annotated[Optional[StrictStr], Field(description="Opaque pagination cursor returned from a previous response (`pagination.next_cursor`). Treat it as an unreadable token; do not attempt to parse or construct it. ")] = None,
|
|
975
975
|
_request_timeout: Union[
|
|
976
976
|
None,
|
|
@@ -1049,7 +1049,7 @@ class ProjectsApi:
|
|
|
1049
1049
|
def projects_list_without_preload_content(
|
|
1050
1050
|
self,
|
|
1051
1051
|
space_id: Annotated[Optional[StrictStr], Field(description="Filter search results to a particular space ID")] = None,
|
|
1052
|
-
limit: Annotated[Optional[Annotated[int, Field(le=
|
|
1052
|
+
limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Maximum items to return")] = None,
|
|
1053
1053
|
cursor: Annotated[Optional[StrictStr], Field(description="Opaque pagination cursor returned from a previous response (`pagination.next_cursor`). Treat it as an unreadable token; do not attempt to parse or construct it. ")] = None,
|
|
1054
1054
|
_request_timeout: Union[
|
|
1055
1055
|
None,
|
|
@@ -29,7 +29,6 @@ from arize._generated.api_client.models.experiments_create_request import Experi
|
|
|
29
29
|
from arize._generated.api_client.models.experiments_list200_response import ExperimentsList200Response
|
|
30
30
|
from arize._generated.api_client.models.experiments_runs_list200_response import ExperimentsRunsList200Response
|
|
31
31
|
from arize._generated.api_client.models.pagination_metadata import PaginationMetadata
|
|
32
|
-
from arize._generated.api_client.models.primitive_value import PrimitiveValue
|
|
33
32
|
from arize._generated.api_client.models.problem import Problem
|
|
34
33
|
from arize._generated.api_client.models.project import Project
|
|
35
34
|
from arize._generated.api_client.models.projects_create_request import ProjectsCreateRequest
|
|
@@ -19,7 +19,6 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
21
|
from typing import Any, ClassVar, Dict, List
|
|
22
|
-
from arize._generated.api_client.models.primitive_value import PrimitiveValue
|
|
23
22
|
from typing import Optional, Set
|
|
24
23
|
from typing_extensions import Self
|
|
25
24
|
|
|
@@ -29,7 +28,7 @@ class DatasetsCreateRequest(BaseModel):
|
|
|
29
28
|
""" # noqa: E501
|
|
30
29
|
name: StrictStr = Field(description="Name of the new dataset")
|
|
31
30
|
space_id: StrictStr = Field(description="ID of the space the dataset will belong to")
|
|
32
|
-
examples: List[Dict[str,
|
|
31
|
+
examples: List[Dict[str, Any]] = Field(description="Array of examples for the new dataset")
|
|
33
32
|
__properties: ClassVar[List[str]] = ["name", "space_id", "examples"]
|
|
34
33
|
|
|
35
34
|
model_config = ConfigDict(
|
|
@@ -71,13 +70,6 @@ class DatasetsCreateRequest(BaseModel):
|
|
|
71
70
|
exclude=excluded_fields,
|
|
72
71
|
exclude_none=True,
|
|
73
72
|
)
|
|
74
|
-
# override the default output from pydantic by calling `to_dict()` of each item in examples (list)
|
|
75
|
-
_items = []
|
|
76
|
-
if self.examples:
|
|
77
|
-
for _item_examples in self.examples:
|
|
78
|
-
if _item_examples:
|
|
79
|
-
_items.append(_item_examples.to_dict())
|
|
80
|
-
_dict['examples'] = _items
|
|
81
73
|
return _dict
|
|
82
74
|
|
|
83
75
|
@classmethod
|
|
@@ -97,7 +89,7 @@ class DatasetsCreateRequest(BaseModel):
|
|
|
97
89
|
_obj = cls.model_validate({
|
|
98
90
|
"name": obj.get("name"),
|
|
99
91
|
"space_id": obj.get("space_id"),
|
|
100
|
-
"examples":
|
|
92
|
+
"examples": obj.get("examples")
|
|
101
93
|
})
|
|
102
94
|
return _obj
|
|
103
95
|
|
|
@@ -19,7 +19,6 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field
|
|
21
21
|
from typing import Any, ClassVar, Dict, List
|
|
22
|
-
from arize._generated.api_client.models.primitive_value import PrimitiveValue
|
|
23
22
|
from typing import Optional, Set
|
|
24
23
|
from typing_extensions import Self
|
|
25
24
|
|
|
@@ -27,7 +26,7 @@ class DatasetsExamplesInsertRequest(BaseModel):
|
|
|
27
26
|
"""
|
|
28
27
|
DatasetsExamplesInsertRequest
|
|
29
28
|
""" # noqa: E501
|
|
30
|
-
examples: List[Dict[str,
|
|
29
|
+
examples: List[Dict[str, Any]] = Field(description="Array of examples to append to the dataset version")
|
|
31
30
|
__properties: ClassVar[List[str]] = ["examples"]
|
|
32
31
|
|
|
33
32
|
model_config = ConfigDict(
|
|
@@ -69,13 +68,6 @@ class DatasetsExamplesInsertRequest(BaseModel):
|
|
|
69
68
|
exclude=excluded_fields,
|
|
70
69
|
exclude_none=True,
|
|
71
70
|
)
|
|
72
|
-
# override the default output from pydantic by calling `to_dict()` of each item in examples (list)
|
|
73
|
-
_items = []
|
|
74
|
-
if self.examples:
|
|
75
|
-
for _item_examples in self.examples:
|
|
76
|
-
if _item_examples:
|
|
77
|
-
_items.append(_item_examples.to_dict())
|
|
78
|
-
_dict['examples'] = _items
|
|
79
71
|
return _dict
|
|
80
72
|
|
|
81
73
|
@classmethod
|
|
@@ -93,7 +85,7 @@ class DatasetsExamplesInsertRequest(BaseModel):
|
|
|
93
85
|
raise ValueError("Error due to additional fields (not defined in DatasetsExamplesInsertRequest) in the input: " + _key)
|
|
94
86
|
|
|
95
87
|
_obj = cls.model_validate({
|
|
96
|
-
"examples":
|
|
88
|
+
"examples": obj.get("examples")
|
|
97
89
|
})
|
|
98
90
|
return _obj
|
|
99
91
|
|
|
@@ -38,9 +38,7 @@ class TestDatasetsCreateRequest(unittest.TestCase):
|
|
|
38
38
|
name = '',
|
|
39
39
|
space_id = '',
|
|
40
40
|
examples = [
|
|
41
|
-
{
|
|
42
|
-
'key' : null
|
|
43
|
-
}
|
|
41
|
+
{ }
|
|
44
42
|
]
|
|
45
43
|
)
|
|
46
44
|
else:
|
|
@@ -48,9 +46,7 @@ class TestDatasetsCreateRequest(unittest.TestCase):
|
|
|
48
46
|
name = '',
|
|
49
47
|
space_id = '',
|
|
50
48
|
examples = [
|
|
51
|
-
{
|
|
52
|
-
'key' : null
|
|
53
|
-
}
|
|
49
|
+
{ }
|
|
54
50
|
],
|
|
55
51
|
)
|
|
56
52
|
"""
|
|
@@ -36,17 +36,13 @@ class TestDatasetsExamplesInsertRequest(unittest.TestCase):
|
|
|
36
36
|
if include_optional:
|
|
37
37
|
return DatasetsExamplesInsertRequest(
|
|
38
38
|
examples = [
|
|
39
|
-
{
|
|
40
|
-
'key' : null
|
|
41
|
-
}
|
|
39
|
+
{ }
|
|
42
40
|
]
|
|
43
41
|
)
|
|
44
42
|
else:
|
|
45
43
|
return DatasetsExamplesInsertRequest(
|
|
46
44
|
examples = [
|
|
47
|
-
{
|
|
48
|
-
'key' : null
|
|
49
|
-
}
|
|
45
|
+
{ }
|
|
50
46
|
],
|
|
51
47
|
)
|
|
52
48
|
"""
|
|
@@ -36,9 +36,7 @@ class TestDatasetsExamplesList200Response(unittest.TestCase):
|
|
|
36
36
|
if include_optional:
|
|
37
37
|
return DatasetsExamplesList200Response(
|
|
38
38
|
examples = [
|
|
39
|
-
{
|
|
40
|
-
'key' : null
|
|
41
|
-
}
|
|
39
|
+
{ }
|
|
42
40
|
],
|
|
43
41
|
pagination = arize._generated.api_client.models.pagination_metadata.PaginationMetadata(
|
|
44
42
|
next_cursor = '',
|
|
@@ -47,9 +45,7 @@ class TestDatasetsExamplesList200Response(unittest.TestCase):
|
|
|
47
45
|
else:
|
|
48
46
|
return DatasetsExamplesList200Response(
|
|
49
47
|
examples = [
|
|
50
|
-
{
|
|
51
|
-
'key' : null
|
|
52
|
-
}
|
|
48
|
+
{ }
|
|
53
49
|
],
|
|
54
50
|
pagination = arize._generated.api_client.models.pagination_metadata.PaginationMetadata(
|
|
55
51
|
next_cursor = '',
|
|
@@ -36,18 +36,14 @@ class TestDatasetsExamplesUpdateRequest(unittest.TestCase):
|
|
|
36
36
|
if include_optional:
|
|
37
37
|
return DatasetsExamplesUpdateRequest(
|
|
38
38
|
examples = [
|
|
39
|
-
{
|
|
40
|
-
'key' : null
|
|
41
|
-
}
|
|
39
|
+
{ }
|
|
42
40
|
],
|
|
43
41
|
new_version = ''
|
|
44
42
|
)
|
|
45
43
|
else:
|
|
46
44
|
return DatasetsExamplesUpdateRequest(
|
|
47
45
|
examples = [
|
|
48
|
-
{
|
|
49
|
-
'key' : null
|
|
50
|
-
}
|
|
46
|
+
{ }
|
|
51
47
|
],
|
|
52
48
|
)
|
|
53
49
|
"""
|
|
@@ -38,9 +38,7 @@ class TestExperimentsCreateRequest(unittest.TestCase):
|
|
|
38
38
|
name = '',
|
|
39
39
|
dataset_id = '',
|
|
40
40
|
experiment_runs = [
|
|
41
|
-
{
|
|
42
|
-
'key' : null
|
|
43
|
-
}
|
|
41
|
+
{ }
|
|
44
42
|
]
|
|
45
43
|
)
|
|
46
44
|
else:
|
|
@@ -48,9 +46,7 @@ class TestExperimentsCreateRequest(unittest.TestCase):
|
|
|
48
46
|
name = '',
|
|
49
47
|
dataset_id = '',
|
|
50
48
|
experiment_runs = [
|
|
51
|
-
{
|
|
52
|
-
'key' : null
|
|
53
|
-
}
|
|
49
|
+
{ }
|
|
54
50
|
],
|
|
55
51
|
)
|
|
56
52
|
"""
|
|
@@ -36,9 +36,7 @@ class TestExperimentsRunsList200Response(unittest.TestCase):
|
|
|
36
36
|
if include_optional:
|
|
37
37
|
return ExperimentsRunsList200Response(
|
|
38
38
|
experiment_runs = [
|
|
39
|
-
{
|
|
40
|
-
'key' : null
|
|
41
|
-
}
|
|
39
|
+
{ }
|
|
42
40
|
],
|
|
43
41
|
pagination = arize._generated.api_client.models.pagination_metadata.PaginationMetadata(
|
|
44
42
|
next_cursor = '',
|
|
@@ -47,9 +45,7 @@ class TestExperimentsRunsList200Response(unittest.TestCase):
|
|
|
47
45
|
else:
|
|
48
46
|
return ExperimentsRunsList200Response(
|
|
49
47
|
experiment_runs = [
|
|
50
|
-
{
|
|
51
|
-
'key' : null
|
|
52
|
-
}
|
|
48
|
+
{ }
|
|
53
49
|
],
|
|
54
50
|
pagination = arize._generated.api_client.models.pagination_metadata.PaginationMetadata(
|
|
55
51
|
next_cursor = '',
|
|
@@ -109,7 +109,6 @@ Class | Method | HTTP request | Description
|
|
|
109
109
|
- [ExperimentsList200Response](arize/_generated/api_client/docs/ExperimentsList200Response.md)
|
|
110
110
|
- [ExperimentsRunsList200Response](arize/_generated/api_client/docs/ExperimentsRunsList200Response.md)
|
|
111
111
|
- [PaginationMetadata](arize/_generated/api_client/docs/PaginationMetadata.md)
|
|
112
|
-
- [PrimitiveValue](arize/_generated/api_client/docs/PrimitiveValue.md)
|
|
113
112
|
- [Problem](arize/_generated/api_client/docs/Problem.md)
|
|
114
113
|
- [Project](arize/_generated/api_client/docs/Project.md)
|
|
115
114
|
- [ProjectsCreateRequest](arize/_generated/api_client/docs/ProjectsCreateRequest.md)
|
arize/_lazy.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# src/arize/_lazy.py
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
+
import inspect
|
|
4
5
|
import logging
|
|
5
6
|
import sys
|
|
6
7
|
import threading
|
|
@@ -8,6 +9,8 @@ from importlib import import_module
|
|
|
8
9
|
from typing import TYPE_CHECKING, ClassVar
|
|
9
10
|
|
|
10
11
|
if TYPE_CHECKING:
|
|
12
|
+
import types
|
|
13
|
+
|
|
11
14
|
from arize.config import SDKConfiguration
|
|
12
15
|
|
|
13
16
|
logger = logging.getLogger(__name__)
|
|
@@ -22,6 +25,11 @@ class LazySubclientsMixin:
|
|
|
22
25
|
self._lazy_cache: dict[str, object] = {}
|
|
23
26
|
self._lazy_lock = threading.Lock()
|
|
24
27
|
|
|
28
|
+
# Add generated client factory
|
|
29
|
+
from arize._client_factory import GeneratedClientFactory
|
|
30
|
+
|
|
31
|
+
self._gen_client_factory = GeneratedClientFactory(sdk_config)
|
|
32
|
+
|
|
25
33
|
def __getattr__(self, name: str) -> object:
|
|
26
34
|
subs = self._SUBCLIENTS
|
|
27
35
|
if name not in subs:
|
|
@@ -41,12 +49,18 @@ class LazySubclientsMixin:
|
|
|
41
49
|
module = _dynamic_import(module_path)
|
|
42
50
|
klass = getattr(module, class_name)
|
|
43
51
|
|
|
44
|
-
#
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
# Determine which parameters this subclient needs
|
|
53
|
+
# and build kwargs accordingly
|
|
54
|
+
sig = inspect.signature(klass.__init__)
|
|
55
|
+
kwargs = {}
|
|
56
|
+
if "sdk_config" in sig.parameters:
|
|
57
|
+
kwargs["sdk_config"] = self.sdk_config
|
|
58
|
+
if "generated_client" in sig.parameters:
|
|
59
|
+
kwargs["generated_client"] = (
|
|
60
|
+
self._gen_client_factory.get_client()
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
instance = klass(**kwargs)
|
|
50
64
|
self._lazy_cache[name] = instance
|
|
51
65
|
return instance
|
|
52
66
|
|
|
@@ -82,8 +96,8 @@ def require(
|
|
|
82
96
|
)
|
|
83
97
|
|
|
84
98
|
|
|
85
|
-
def _dynamic_import(modname: str, retries: int = 2) ->
|
|
86
|
-
def _attempt_import(remaining_attempts: int) ->
|
|
99
|
+
def _dynamic_import(modname: str, retries: int = 2) -> types.ModuleType:
|
|
100
|
+
def _attempt_import(remaining_attempts: int) -> types.ModuleType:
|
|
87
101
|
try:
|
|
88
102
|
return import_module(modname)
|
|
89
103
|
except (ModuleNotFoundError, ImportError, KeyError):
|
|
@@ -92,4 +106,6 @@ def _dynamic_import(modname: str, retries: int = 2) -> object:
|
|
|
92
106
|
raise
|
|
93
107
|
return _attempt_import(remaining_attempts - 1)
|
|
94
108
|
|
|
95
|
-
|
|
109
|
+
if retries <= 0:
|
|
110
|
+
raise ValueError(f"retries must be > 0, got {retries}")
|
|
111
|
+
return _attempt_import(retries)
|