arize 8.0.0a15__py3-none-any.whl → 8.0.0a17__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 +71 -1
- arize/_flight/client.py +188 -41
- arize/_flight/types.py +1 -0
- arize/_generated/api_client/__init__.py +5 -1
- arize/_generated/api_client/api/datasets_api.py +6 -6
- arize/_generated/api_client/api/experiments_api.py +924 -61
- arize/_generated/api_client/api_client.py +1 -1
- arize/_generated/api_client/configuration.py +1 -1
- arize/_generated/api_client/exceptions.py +1 -1
- arize/_generated/api_client/models/__init__.py +3 -1
- arize/_generated/api_client/models/dataset.py +2 -2
- arize/_generated/api_client/models/dataset_version.py +1 -1
- arize/_generated/api_client/models/datasets_create_request.py +3 -3
- arize/_generated/api_client/models/datasets_list200_response.py +1 -1
- arize/_generated/api_client/models/datasets_list_examples200_response.py +1 -1
- arize/_generated/api_client/models/error.py +1 -1
- arize/_generated/api_client/models/experiment.py +6 -6
- arize/_generated/api_client/models/experiments_create_request.py +98 -0
- arize/_generated/api_client/models/experiments_list200_response.py +1 -1
- arize/_generated/api_client/models/experiments_runs_list200_response.py +92 -0
- arize/_generated/api_client/rest.py +1 -1
- arize/_generated/api_client/test/test_dataset.py +2 -1
- arize/_generated/api_client/test/test_dataset_version.py +1 -1
- arize/_generated/api_client/test/test_datasets_api.py +1 -1
- arize/_generated/api_client/test/test_datasets_create_request.py +2 -1
- arize/_generated/api_client/test/test_datasets_list200_response.py +1 -1
- arize/_generated/api_client/test/test_datasets_list_examples200_response.py +1 -1
- arize/_generated/api_client/test/test_error.py +1 -1
- arize/_generated/api_client/test/test_experiment.py +6 -1
- arize/_generated/api_client/test/test_experiments_api.py +23 -2
- arize/_generated/api_client/test/test_experiments_create_request.py +61 -0
- arize/_generated/api_client/test/test_experiments_list200_response.py +1 -1
- arize/_generated/api_client/test/test_experiments_runs_list200_response.py +56 -0
- arize/_generated/api_client_README.md +13 -8
- arize/client.py +27 -2
- arize/config.py +64 -3
- arize/constants/config.py +12 -2
- arize/constants/openinference.py +14 -0
- arize/constants/pyarrow.py +1 -0
- arize/datasets/__init__.py +0 -70
- arize/datasets/client.py +128 -20
- arize/datasets/errors.py +61 -0
- arize/datasets/validation.py +46 -0
- arize/experiments/client.py +556 -0
- arize/experiments/evaluators/__init__.py +0 -0
- arize/experiments/evaluators/base.py +255 -0
- arize/experiments/evaluators/exceptions.py +10 -0
- arize/experiments/evaluators/executors.py +502 -0
- arize/experiments/evaluators/rate_limiters.py +277 -0
- arize/experiments/evaluators/types.py +122 -0
- arize/experiments/evaluators/utils.py +198 -0
- arize/experiments/functions.py +920 -0
- arize/experiments/tracing.py +276 -0
- arize/experiments/types.py +394 -0
- arize/models/client.py +4 -1
- arize/spans/client.py +16 -20
- arize/utils/arrow.py +4 -3
- arize/utils/cache.py +68 -0
- arize/utils/openinference_conversion.py +56 -0
- arize/utils/proto.py +13 -0
- arize/utils/size.py +22 -0
- arize/version.py +1 -1
- {arize-8.0.0a15.dist-info → arize-8.0.0a17.dist-info}/METADATA +219 -14
- {arize-8.0.0a15.dist-info → arize-8.0.0a17.dist-info}/RECORD +66 -44
- {arize-8.0.0a15.dist-info → arize-8.0.0a17.dist-info}/WHEEL +0 -0
- {arize-8.0.0a15.dist-info → arize-8.0.0a17.dist-info}/licenses/LICENSE.md +0 -0
arize/__init__.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
# src/arize/__init__.py
|
|
2
1
|
import logging
|
|
2
|
+
from collections.abc import Mapping
|
|
3
3
|
|
|
4
|
+
from arize._generated.api_client import models
|
|
4
5
|
from arize.client import ArizeClient
|
|
5
6
|
from arize.config import SDKConfiguration
|
|
6
7
|
|
|
@@ -18,3 +19,72 @@ except Exception:
|
|
|
18
19
|
pass
|
|
19
20
|
|
|
20
21
|
__all__ = ["ArizeClient", "SDKConfiguration"]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def make_to_df(field_name: str):
|
|
25
|
+
def to_df(
|
|
26
|
+
self,
|
|
27
|
+
by_alias: bool = False,
|
|
28
|
+
exclude_none: str | bool = False,
|
|
29
|
+
json_normalize: bool = False,
|
|
30
|
+
convert_dtypes: bool = True,
|
|
31
|
+
):
|
|
32
|
+
"""
|
|
33
|
+
Convert a list of objects to a pandas DataFrame.
|
|
34
|
+
|
|
35
|
+
Behavior:
|
|
36
|
+
- If an item is a Pydantic v2 model, use `.model_dump(by_alias=...)`.
|
|
37
|
+
- If an item is a mapping (dict-like), use it as-is.
|
|
38
|
+
- Otherwise, raise a ValueError (unsupported row type).
|
|
39
|
+
|
|
40
|
+
Parameters:
|
|
41
|
+
by_alias: Use field aliases when dumping Pydantic models.
|
|
42
|
+
exclude_none:
|
|
43
|
+
- False: keep Nones as-is
|
|
44
|
+
- "all": drop columns where *all* values are None/NaN
|
|
45
|
+
- "any": drop columns where *any* value is None/NaN
|
|
46
|
+
- True: alias for "all"
|
|
47
|
+
json_normalize: If True, flatten nested dicts via `pandas.json_normalize`.
|
|
48
|
+
convert_dtypes: If True, call `DataFrame.convert_dtypes()` at the end.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
pandas.DataFrame
|
|
52
|
+
"""
|
|
53
|
+
import pandas as pd
|
|
54
|
+
|
|
55
|
+
items = getattr(self, field_name, []) or []
|
|
56
|
+
|
|
57
|
+
rows = []
|
|
58
|
+
for it in items:
|
|
59
|
+
if hasattr(it, "model_dump"): # Pydantic v2 object
|
|
60
|
+
rows.append(it.model_dump(by_alias=by_alias))
|
|
61
|
+
|
|
62
|
+
elif isinstance(it, Mapping): # Plain mapping
|
|
63
|
+
rows.append(it)
|
|
64
|
+
else:
|
|
65
|
+
raise ValueError(
|
|
66
|
+
f"Cannot convert item of type {type(it)} to DataFrame row"
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
df = (
|
|
70
|
+
pd.json_normalize(rows, sep=".")
|
|
71
|
+
if json_normalize
|
|
72
|
+
else pd.DataFrame(rows)
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
# Drop None/NaN columns if requested
|
|
76
|
+
if exclude_none in ("any", "all", True):
|
|
77
|
+
drop_how = "all" if exclude_none is True else exclude_none
|
|
78
|
+
df.dropna(axis=1, how=drop_how, inplace=True)
|
|
79
|
+
|
|
80
|
+
if convert_dtypes:
|
|
81
|
+
df = df.convert_dtypes()
|
|
82
|
+
return df
|
|
83
|
+
|
|
84
|
+
return to_df
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
models.DatasetsList200Response.to_df = make_to_df("datasets") # type: ignore[attr-defined]
|
|
88
|
+
models.DatasetsListExamples200Response.to_df = make_to_df("examples") # type: ignore[attr-defined]
|
|
89
|
+
models.ExperimentsList200Response.to_df = make_to_df("experiments") # type: ignore[attr-defined]
|
|
90
|
+
models.ExperimentsRunsList200Response.to_df = make_to_df("experiment_runs") # type: ignore[attr-defined]
|
arize/_flight/client.py
CHANGED
|
@@ -4,7 +4,8 @@ from __future__ import annotations
|
|
|
4
4
|
import base64
|
|
5
5
|
import logging
|
|
6
6
|
from dataclasses import dataclass, field
|
|
7
|
-
from
|
|
7
|
+
from enum import Enum
|
|
8
|
+
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Tuple
|
|
8
9
|
|
|
9
10
|
from google.protobuf import json_format
|
|
10
11
|
from pyarrow import flight
|
|
@@ -12,35 +13,49 @@ from pyarrow import flight
|
|
|
12
13
|
from arize._flight.types import FlightRequestType
|
|
13
14
|
from arize._generated.protocol.flight import ingest_pb2 as flight_ing_pb2
|
|
14
15
|
from arize._generated.protocol.flight.ingest_pb2 import (
|
|
16
|
+
PostExperimentDataResponse,
|
|
15
17
|
WriteSpanAnnotationResponse,
|
|
16
18
|
WriteSpanAttributesMetadataResponse,
|
|
17
19
|
WriteSpanEvaluationResponse,
|
|
18
20
|
)
|
|
19
21
|
from arize.config import get_python_version
|
|
20
22
|
from arize.logging import log_a_list
|
|
23
|
+
from arize.utils.openinference_conversion import convert_json_str_to_dict
|
|
24
|
+
from arize.utils.proto import get_pb_schema_tracing
|
|
21
25
|
from arize.version import __version__
|
|
22
26
|
|
|
23
27
|
if TYPE_CHECKING:
|
|
28
|
+
import pandas as pd
|
|
24
29
|
import pyarrow as pa
|
|
25
30
|
|
|
26
31
|
|
|
27
32
|
BytesPair = Tuple[bytes, bytes]
|
|
28
33
|
Headers = List[BytesPair]
|
|
29
|
-
|
|
34
|
+
FlightPostArrowFileResponse = (
|
|
30
35
|
WriteSpanEvaluationResponse
|
|
31
36
|
| WriteSpanAnnotationResponse
|
|
32
37
|
| WriteSpanAttributesMetadataResponse
|
|
38
|
+
| PostExperimentDataResponse
|
|
33
39
|
)
|
|
34
40
|
|
|
35
41
|
logger = logging.getLogger(__name__)
|
|
36
42
|
|
|
37
43
|
|
|
44
|
+
class FlightActionKey(Enum):
|
|
45
|
+
CREATE_EXPERIMENT_DB_ENTRY = "create_experiment_db_entry"
|
|
46
|
+
# GET_DATASET_VERSION = "get_dataset_version"
|
|
47
|
+
# LIST_DATASETS = "list_datasets"
|
|
48
|
+
# DELETE_DATASET = "delete_dataset"
|
|
49
|
+
# DELETE_EXPERIMENT = "delete_experiment"
|
|
50
|
+
|
|
51
|
+
|
|
38
52
|
@dataclass(frozen=True)
|
|
39
53
|
class ArizeFlightClient:
|
|
40
54
|
api_key: str = field(repr=False)
|
|
41
55
|
host: str
|
|
42
56
|
port: int
|
|
43
57
|
scheme: str
|
|
58
|
+
max_chunksize: int
|
|
44
59
|
request_verify: bool
|
|
45
60
|
|
|
46
61
|
# internal cache for the underlying FlightClient
|
|
@@ -107,17 +122,19 @@ class ArizeFlightClient:
|
|
|
107
122
|
kwargs.setdefault("options", self.call_options)
|
|
108
123
|
return client.get_flight_info(*args, **kwargs)
|
|
109
124
|
|
|
110
|
-
def do_get(self, *args: Any, **kwargs: Any):
|
|
125
|
+
def do_get(self, *args: Any, **kwargs: Any) -> flight.FlightStreamReader:
|
|
111
126
|
client = self._ensure_client()
|
|
112
127
|
kwargs.setdefault("options", self.call_options)
|
|
113
128
|
return client.do_get(*args, **kwargs)
|
|
114
129
|
|
|
115
|
-
def do_put(
|
|
130
|
+
def do_put(
|
|
131
|
+
self, *args: Any, **kwargs: Any
|
|
132
|
+
) -> [flight.FlightStreamWriter, flight.FlightMetadataReader]:
|
|
116
133
|
client = self._ensure_client()
|
|
117
134
|
kwargs.setdefault("options", self.call_options)
|
|
118
135
|
return client.do_put(*args, **kwargs)
|
|
119
136
|
|
|
120
|
-
def do_action(self, *args: Any, **kwargs: Any):
|
|
137
|
+
def do_action(self, *args: Any, **kwargs: Any) -> Iterable[flight.Result]:
|
|
121
138
|
client = self._ensure_client()
|
|
122
139
|
kwargs.setdefault("options", self.call_options)
|
|
123
140
|
return client.do_action(*args, **kwargs)
|
|
@@ -127,20 +144,30 @@ class ArizeFlightClient:
|
|
|
127
144
|
def log_arrow_table(
|
|
128
145
|
self,
|
|
129
146
|
space_id: str,
|
|
130
|
-
project_name: str,
|
|
131
147
|
request_type: FlightRequestType,
|
|
132
148
|
pa_table: pa.Table,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
149
|
+
project_name: str | None = None,
|
|
150
|
+
dataset_id: str | None = None,
|
|
151
|
+
experiment_name: str | None = None,
|
|
152
|
+
) -> FlightPostArrowFileResponse:
|
|
153
|
+
pa_schema = pa_table.schema
|
|
154
|
+
if request_type in (
|
|
155
|
+
FlightRequestType.EVALUATION,
|
|
156
|
+
FlightRequestType.ANNOTATION,
|
|
157
|
+
FlightRequestType.METADATA,
|
|
158
|
+
):
|
|
159
|
+
proto_schema = get_pb_schema_tracing(project_name=project_name)
|
|
160
|
+
base64_schema = base64.b64encode(proto_schema.SerializeToString())
|
|
161
|
+
pa_schema = append_to_pyarrow_metadata(
|
|
162
|
+
pa_table.schema, {"arize-schema": base64_schema}
|
|
163
|
+
)
|
|
139
164
|
|
|
140
165
|
doput_request = _get_pb_flight_doput_request(
|
|
141
166
|
space_id=space_id,
|
|
142
|
-
model_id=project_name,
|
|
143
167
|
request_type=request_type,
|
|
168
|
+
model_id=project_name,
|
|
169
|
+
dataset_id=dataset_id,
|
|
170
|
+
experiment_name=experiment_name,
|
|
144
171
|
)
|
|
145
172
|
|
|
146
173
|
descriptor = flight.FlightDescriptor.for_command(
|
|
@@ -152,7 +179,7 @@ class ArizeFlightClient:
|
|
|
152
179
|
)
|
|
153
180
|
with flight_writer:
|
|
154
181
|
# write table as stream to flight server
|
|
155
|
-
flight_writer.write_table(pa_table)
|
|
182
|
+
flight_writer.write_table(pa_table, self.max_chunksize)
|
|
156
183
|
# indicate that client has flushed all contents to stream
|
|
157
184
|
flight_writer.done_writing()
|
|
158
185
|
# read response from flight server
|
|
@@ -171,11 +198,13 @@ class ArizeFlightClient:
|
|
|
171
198
|
case FlightRequestType.METADATA:
|
|
172
199
|
res = WriteSpanAttributesMetadataResponse()
|
|
173
200
|
res.ParseFromString(flight_response.to_pybytes())
|
|
201
|
+
case FlightRequestType.LOG_EXPERIMENT_DATA:
|
|
202
|
+
res = PostExperimentDataResponse()
|
|
203
|
+
res.ParseFromString(flight_response.to_pybytes())
|
|
174
204
|
case _:
|
|
175
205
|
raise ValueError(
|
|
176
206
|
f"Unsupported request_type: {request_type}"
|
|
177
207
|
)
|
|
178
|
-
|
|
179
208
|
return res
|
|
180
209
|
except Exception as e:
|
|
181
210
|
logger.exception(f"Error logging arrow table to Arize: {e}")
|
|
@@ -207,7 +236,7 @@ class ArizeFlightClient:
|
|
|
207
236
|
)
|
|
208
237
|
with flight_writer:
|
|
209
238
|
# write table as stream to flight server
|
|
210
|
-
flight_writer.write_table(pa_table)
|
|
239
|
+
flight_writer.write_table(pa_table, self.max_chunksize)
|
|
211
240
|
# indicate that client has flushed all contents to stream
|
|
212
241
|
flight_writer.done_writing()
|
|
213
242
|
# read response from flight server
|
|
@@ -227,6 +256,99 @@ class ArizeFlightClient:
|
|
|
227
256
|
f"Error logging arrow table to Arize: {e}"
|
|
228
257
|
) from e
|
|
229
258
|
|
|
259
|
+
def get_dataset_examples(
|
|
260
|
+
self,
|
|
261
|
+
space_id: str,
|
|
262
|
+
dataset_id: str,
|
|
263
|
+
dataset_version_id: str | None = None,
|
|
264
|
+
) -> pd.DataFrame:
|
|
265
|
+
# TODO(Kiko): Space ID should not be needed,
|
|
266
|
+
# should work on server tech debt to remove this
|
|
267
|
+
doget_request = flight_ing_pb2.DoGetRequest(
|
|
268
|
+
get_dataset=flight_ing_pb2.GetDatasetRequest(
|
|
269
|
+
space_id=space_id,
|
|
270
|
+
dataset_id=dataset_id,
|
|
271
|
+
dataset_version=dataset_version_id,
|
|
272
|
+
)
|
|
273
|
+
)
|
|
274
|
+
descriptor = flight.Ticket(
|
|
275
|
+
json_format.MessageToJson(doget_request).encode("utf-8")
|
|
276
|
+
)
|
|
277
|
+
try:
|
|
278
|
+
reader = self.do_get(descriptor, options=self.call_options)
|
|
279
|
+
# read all data into pandas dataframe
|
|
280
|
+
df = reader.read_all().to_pandas()
|
|
281
|
+
df = convert_json_str_to_dict(df)
|
|
282
|
+
return df
|
|
283
|
+
except Exception as e:
|
|
284
|
+
logger.exception(f"Failed to get dataset id={dataset_id}")
|
|
285
|
+
raise RuntimeError(f"Failed to get dataset id={dataset_id}") from e
|
|
286
|
+
|
|
287
|
+
# ---------- experiment methods ----------
|
|
288
|
+
|
|
289
|
+
def get_experiment_runs(
|
|
290
|
+
self,
|
|
291
|
+
space_id: str,
|
|
292
|
+
experiment_id: str,
|
|
293
|
+
) -> pd.DataFrame:
|
|
294
|
+
# TODO(Kiko): Space ID should not be needed,
|
|
295
|
+
# should work on server tech debt to remove this
|
|
296
|
+
doget_request = flight_ing_pb2.DoGetRequest(
|
|
297
|
+
get_experiment=flight_ing_pb2.GetExperimentRequest(
|
|
298
|
+
space_id=space_id,
|
|
299
|
+
experiment_id=experiment_id,
|
|
300
|
+
)
|
|
301
|
+
)
|
|
302
|
+
descriptor = flight.Ticket(
|
|
303
|
+
json_format.MessageToJson(doget_request).encode("utf-8")
|
|
304
|
+
)
|
|
305
|
+
try:
|
|
306
|
+
reader = self.do_get(descriptor, options=self.call_options)
|
|
307
|
+
# read all data into pandas dataframe
|
|
308
|
+
df = reader.read_all().to_pandas()
|
|
309
|
+
df = convert_json_str_to_dict(df)
|
|
310
|
+
return df
|
|
311
|
+
except Exception as e:
|
|
312
|
+
logger.exception(f"Failed to get experiment id={experiment_id}")
|
|
313
|
+
raise RuntimeError(
|
|
314
|
+
f"Failed to get experiment id={experiment_id}"
|
|
315
|
+
) from e
|
|
316
|
+
|
|
317
|
+
def init_experiment(
|
|
318
|
+
self,
|
|
319
|
+
space_id: str,
|
|
320
|
+
dataset_id: str,
|
|
321
|
+
experiment_name: str,
|
|
322
|
+
) -> Tuple[str, str] | None:
|
|
323
|
+
request = flight_ing_pb2.DoActionRequest(
|
|
324
|
+
create_experiment_db_entry=flight_ing_pb2.CreateExperimentDBEntryRequest(
|
|
325
|
+
space_id=space_id,
|
|
326
|
+
dataset_id=dataset_id,
|
|
327
|
+
experiment_name=experiment_name,
|
|
328
|
+
)
|
|
329
|
+
)
|
|
330
|
+
action = flight.Action(
|
|
331
|
+
FlightActionKey.CREATE_EXPERIMENT_DB_ENTRY,
|
|
332
|
+
json_format.MessageToJson(request).encode("utf-8"),
|
|
333
|
+
)
|
|
334
|
+
try:
|
|
335
|
+
response = self.do_action(action, options=self.call_options)
|
|
336
|
+
except Exception as e:
|
|
337
|
+
logger.exception(f"Failed to init experiment {experiment_name}")
|
|
338
|
+
raise RuntimeError(
|
|
339
|
+
f"Failed to init experiment {experiment_name}"
|
|
340
|
+
) from e
|
|
341
|
+
|
|
342
|
+
res = next(response, None)
|
|
343
|
+
if res is None:
|
|
344
|
+
return None
|
|
345
|
+
resp_pb = flight_ing_pb2.CreateExperimentDBEntryResponse()
|
|
346
|
+
resp_pb.ParseFromString(res.body.to_pybytes())
|
|
347
|
+
return (
|
|
348
|
+
resp_pb.experiment_id,
|
|
349
|
+
resp_pb.trace_model_name,
|
|
350
|
+
)
|
|
351
|
+
|
|
230
352
|
|
|
231
353
|
def append_to_pyarrow_metadata(
|
|
232
354
|
pa_schema: pa.Schema, new_metadata: Dict[str, Any]
|
|
@@ -250,34 +372,59 @@ def append_to_pyarrow_metadata(
|
|
|
250
372
|
|
|
251
373
|
|
|
252
374
|
def _get_pb_flight_doput_request(
|
|
253
|
-
space_id,
|
|
254
|
-
model_id: str,
|
|
375
|
+
space_id: str,
|
|
255
376
|
request_type: FlightRequestType,
|
|
377
|
+
model_id: str | None = None,
|
|
378
|
+
dataset_id: str | None = None,
|
|
379
|
+
experiment_name: str | None = None,
|
|
256
380
|
) -> flight_ing_pb2.DoPutRequest:
|
|
257
381
|
"""Return a DoPutRequest for the given request_type."""
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
382
|
+
|
|
383
|
+
common_args = {"space_id": space_id}
|
|
384
|
+
|
|
385
|
+
if model_id:
|
|
386
|
+
common_args["external_model_id"] = model_id
|
|
387
|
+
if dataset_id:
|
|
388
|
+
common_args["dataset_id"] = dataset_id
|
|
389
|
+
if experiment_name:
|
|
390
|
+
common_args["experiment_name"] = experiment_name
|
|
391
|
+
|
|
392
|
+
if model_id:
|
|
393
|
+
# model-based request types
|
|
394
|
+
match request_type:
|
|
395
|
+
case FlightRequestType.LOG_EXPERIMENT_DATA:
|
|
396
|
+
return flight_ing_pb2.DoPutRequest(
|
|
397
|
+
write_span_evaluation_request=flight_ing_pb2.WriteSpanEvaluationRequest(
|
|
398
|
+
**common_args
|
|
399
|
+
)
|
|
268
400
|
)
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
401
|
+
case FlightRequestType.ANNOTATION:
|
|
402
|
+
return flight_ing_pb2.DoPutRequest(
|
|
403
|
+
write_span_annotation_request=flight_ing_pb2.WriteSpanAnnotationRequest(
|
|
404
|
+
**common_args
|
|
405
|
+
)
|
|
274
406
|
)
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
407
|
+
case FlightRequestType.METADATA:
|
|
408
|
+
return flight_ing_pb2.DoPutRequest(
|
|
409
|
+
write_span_attributes_metadata_request=flight_ing_pb2.WriteSpanAttributesMetadataRequest(
|
|
410
|
+
**common_args
|
|
411
|
+
)
|
|
280
412
|
)
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
413
|
+
case _:
|
|
414
|
+
raise ValueError(f"Unsupported request_type: {request_type}")
|
|
415
|
+
|
|
416
|
+
if dataset_id and experiment_name:
|
|
417
|
+
# dataset-based request types
|
|
418
|
+
match request_type:
|
|
419
|
+
case FlightRequestType.LOG_EXPERIMENT_DATA:
|
|
420
|
+
return flight_ing_pb2.DoPutRequest(
|
|
421
|
+
post_experiment_data=flight_ing_pb2.PostExperimentDataRequest(
|
|
422
|
+
**common_args
|
|
423
|
+
)
|
|
424
|
+
)
|
|
425
|
+
case _:
|
|
426
|
+
raise ValueError(f"Unsupported request_type: {request_type}")
|
|
427
|
+
|
|
428
|
+
raise ValueError(
|
|
429
|
+
f"Unsupported combination: {request_type=} with provided arguments."
|
|
430
|
+
)
|
arize/_flight/types.py
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"""
|
|
6
6
|
Arize REST API
|
|
7
7
|
|
|
8
|
-
API specification for the backend data server. The API is hosted globally at https://
|
|
8
|
+
API specification for the backend data server. The API is hosted globally at https://api.arize.com/v2 or in your own environment. You can access the OpenAPI spec for this API at https://api.arize.com/v2/spec.yaml
|
|
9
9
|
|
|
10
10
|
The version of the OpenAPI document: 0.0.1
|
|
11
11
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
@@ -36,7 +36,9 @@ __all__ = [
|
|
|
36
36
|
"DatasetsListExamples200Response",
|
|
37
37
|
"Error",
|
|
38
38
|
"Experiment",
|
|
39
|
+
"ExperimentsCreateRequest",
|
|
39
40
|
"ExperimentsList200Response",
|
|
41
|
+
"ExperimentsRunsList200Response",
|
|
40
42
|
]
|
|
41
43
|
|
|
42
44
|
# import apis into sdk package
|
|
@@ -62,5 +64,7 @@ from arize._generated.api_client.models.datasets_list200_response import Dataset
|
|
|
62
64
|
from arize._generated.api_client.models.datasets_list_examples200_response import DatasetsListExamples200Response as DatasetsListExamples200Response
|
|
63
65
|
from arize._generated.api_client.models.error import Error as Error
|
|
64
66
|
from arize._generated.api_client.models.experiment import Experiment as Experiment
|
|
67
|
+
from arize._generated.api_client.models.experiments_create_request import ExperimentsCreateRequest as ExperimentsCreateRequest
|
|
65
68
|
from arize._generated.api_client.models.experiments_list200_response import ExperimentsList200Response as ExperimentsList200Response
|
|
69
|
+
from arize._generated.api_client.models.experiments_runs_list200_response import ExperimentsRunsList200Response as ExperimentsRunsList200Response
|
|
66
70
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"""
|
|
4
4
|
Arize REST API
|
|
5
5
|
|
|
6
|
-
API specification for the backend data server. The API is hosted globally at https://
|
|
6
|
+
API specification for the backend data server. The API is hosted globally at https://api.arize.com/v2 or in your own environment. You can access the OpenAPI spec for this API at https://api.arize.com/v2/spec.yaml
|
|
7
7
|
|
|
8
8
|
The version of the OpenAPI document: 0.0.1
|
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
@@ -309,7 +309,7 @@ class DatasetsApi:
|
|
|
309
309
|
|
|
310
310
|
return self.api_client.param_serialize(
|
|
311
311
|
method='POST',
|
|
312
|
-
resource_path='/
|
|
312
|
+
resource_path='/v2/datasets',
|
|
313
313
|
path_params=_path_params,
|
|
314
314
|
query_params=_query_params,
|
|
315
315
|
header_params=_header_params,
|
|
@@ -585,7 +585,7 @@ class DatasetsApi:
|
|
|
585
585
|
|
|
586
586
|
return self.api_client.param_serialize(
|
|
587
587
|
method='DELETE',
|
|
588
|
-
resource_path='/
|
|
588
|
+
resource_path='/v2/datasets/{datasetId}',
|
|
589
589
|
path_params=_path_params,
|
|
590
590
|
query_params=_query_params,
|
|
591
591
|
header_params=_header_params,
|
|
@@ -878,7 +878,7 @@ class DatasetsApi:
|
|
|
878
878
|
|
|
879
879
|
return self.api_client.param_serialize(
|
|
880
880
|
method='GET',
|
|
881
|
-
resource_path='/
|
|
881
|
+
resource_path='/v2/datasets/{datasetId}',
|
|
882
882
|
path_params=_path_params,
|
|
883
883
|
query_params=_query_params,
|
|
884
884
|
header_params=_header_params,
|
|
@@ -1170,7 +1170,7 @@ class DatasetsApi:
|
|
|
1170
1170
|
|
|
1171
1171
|
return self.api_client.param_serialize(
|
|
1172
1172
|
method='GET',
|
|
1173
|
-
resource_path='/
|
|
1173
|
+
resource_path='/v2/datasets',
|
|
1174
1174
|
path_params=_path_params,
|
|
1175
1175
|
query_params=_query_params,
|
|
1176
1176
|
header_params=_header_params,
|
|
@@ -1480,7 +1480,7 @@ class DatasetsApi:
|
|
|
1480
1480
|
|
|
1481
1481
|
return self.api_client.param_serialize(
|
|
1482
1482
|
method='GET',
|
|
1483
|
-
resource_path='/
|
|
1483
|
+
resource_path='/v2/datasets/{datasetId}/examples',
|
|
1484
1484
|
path_params=_path_params,
|
|
1485
1485
|
query_params=_query_params,
|
|
1486
1486
|
header_params=_header_params,
|