orca-sdk 0.0.92__py3-none-any.whl → 0.0.93__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.
- orca_sdk/_generated_api_client/api/__init__.py +4 -0
- orca_sdk/_generated_api_client/api/memoryset/suggest_cascading_edits_memoryset_name_or_id_memory_memory_id_cascading_edits_post.py +233 -0
- orca_sdk/_generated_api_client/models/__init__.py +4 -0
- orca_sdk/_generated_api_client/models/cascade_edit_suggestions_request.py +154 -0
- orca_sdk/_generated_api_client/models/cascading_edit_suggestion.py +92 -0
- orca_sdk/_generated_api_client/models/classification_evaluation_result.py +62 -0
- orca_sdk/_generated_api_client/models/filter_item_field_type_0_item.py +1 -0
- orca_sdk/_generated_api_client/models/label_prediction_memory_lookup.py +8 -0
- orca_sdk/_generated_api_client/models/labeled_memory.py +8 -0
- orca_sdk/_generated_api_client/models/labeled_memory_lookup.py +8 -0
- orca_sdk/_generated_api_client/models/labeled_memory_with_feedback_metrics.py +8 -0
- orca_sdk/_generated_api_client/models/prediction_request.py +16 -7
- orca_sdk/_utils/data_parsing.py +31 -2
- orca_sdk/_utils/data_parsing_test.py +18 -15
- orca_sdk/_utils/tqdm_file_reader.py +12 -0
- orca_sdk/classification_model.py +27 -9
- orca_sdk/classification_model_test.py +49 -34
- orca_sdk/conftest.py +86 -25
- orca_sdk/datasource.py +22 -12
- orca_sdk/embedding_model_test.py +6 -5
- orca_sdk/memoryset.py +78 -0
- orca_sdk/memoryset_test.py +197 -123
- {orca_sdk-0.0.92.dist-info → orca_sdk-0.0.93.dist-info}/METADATA +1 -1
- {orca_sdk-0.0.92.dist-info → orca_sdk-0.0.93.dist-info}/RECORD +25 -21
- {orca_sdk-0.0.92.dist-info → orca_sdk-0.0.93.dist-info}/WHEEL +0 -0
|
@@ -112,6 +112,9 @@ from .memoryset.potential_duplicate_groups_memoryset_name_or_id_potential_duplic
|
|
|
112
112
|
from .memoryset.query_memoryset_memoryset_name_or_id_memories_post import (
|
|
113
113
|
sync as query_memoryset,
|
|
114
114
|
)
|
|
115
|
+
from .memoryset.suggest_cascading_edits_memoryset_name_or_id_memory_memory_id_cascading_edits_post import (
|
|
116
|
+
sync as suggest_cascading_edits,
|
|
117
|
+
)
|
|
115
118
|
from .memoryset.update_memories_gpu_memoryset_name_or_id_memories_patch import (
|
|
116
119
|
sync as update_memories_gpu,
|
|
117
120
|
)
|
|
@@ -225,6 +228,7 @@ __all__ = [
|
|
|
225
228
|
"predict_gpu",
|
|
226
229
|
"query_memoryset",
|
|
227
230
|
"record_prediction_feedback",
|
|
231
|
+
"suggest_cascading_edits",
|
|
228
232
|
"update_memories_gpu",
|
|
229
233
|
"update_memory_gpu",
|
|
230
234
|
"update_memoryset",
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This file is generated by the openapi-python-client tool via the generate_api_client.py script
|
|
3
|
+
|
|
4
|
+
It is a customized template from the openapi-python-client tool's default template:
|
|
5
|
+
https://github.com/openapi-generators/openapi-python-client/blob/861ef5622f10fc96d240dc9becb0edf94e61446c/openapi_python_client/templates/endpoint_module.py.jinja
|
|
6
|
+
|
|
7
|
+
The main changes are:
|
|
8
|
+
- Update the API call responses to either return the successful response type or raise an error by:
|
|
9
|
+
- Updating the _parse_response function to raise an error if the response status code is not in the 2xx range
|
|
10
|
+
- Inject a client into every method via a context manager
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from http import HTTPStatus
|
|
14
|
+
from typing import Any, Dict, List
|
|
15
|
+
|
|
16
|
+
import httpx
|
|
17
|
+
|
|
18
|
+
from ...client import _client_context
|
|
19
|
+
from ...errors import get_error_for_response
|
|
20
|
+
from ...models.cascade_edit_suggestions_request import CascadeEditSuggestionsRequest
|
|
21
|
+
from ...models.cascading_edit_suggestion import CascadingEditSuggestion
|
|
22
|
+
from ...types import Response
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _get_kwargs(
|
|
26
|
+
name_or_id: str,
|
|
27
|
+
memory_id: str,
|
|
28
|
+
*,
|
|
29
|
+
body: CascadeEditSuggestionsRequest,
|
|
30
|
+
) -> dict[str, Any]:
|
|
31
|
+
headers: Dict[str, Any] = {}
|
|
32
|
+
|
|
33
|
+
_kwargs: dict[str, Any] = {
|
|
34
|
+
"method": "post",
|
|
35
|
+
"url": f"/memoryset/{name_or_id}/memory/{memory_id}/cascading_edits",
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
_body = body.to_dict()
|
|
39
|
+
|
|
40
|
+
_kwargs["json"] = _body
|
|
41
|
+
headers["Content-Type"] = "application/json"
|
|
42
|
+
|
|
43
|
+
_kwargs["headers"] = headers
|
|
44
|
+
return _kwargs
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _parse_response(*, response: httpx.Response) -> List["CascadingEditSuggestion"]:
|
|
48
|
+
if response.status_code == 200:
|
|
49
|
+
response_200 = []
|
|
50
|
+
_response_200 = response.json()
|
|
51
|
+
for response_200_item_data in _response_200:
|
|
52
|
+
response_200_item = CascadingEditSuggestion.from_dict(response_200_item_data)
|
|
53
|
+
|
|
54
|
+
response_200.append(response_200_item)
|
|
55
|
+
|
|
56
|
+
return response_200
|
|
57
|
+
if response.status_code == 401:
|
|
58
|
+
raise get_error_for_response(response)
|
|
59
|
+
if response.status_code == 500:
|
|
60
|
+
raise get_error_for_response(response)
|
|
61
|
+
if response.status_code == 503:
|
|
62
|
+
raise get_error_for_response(response)
|
|
63
|
+
if response.status_code == 404:
|
|
64
|
+
raise get_error_for_response(response)
|
|
65
|
+
else:
|
|
66
|
+
raise get_error_for_response(response)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _build_response(*, response: httpx.Response) -> Response[List["CascadingEditSuggestion"]]:
|
|
70
|
+
return Response(
|
|
71
|
+
status_code=HTTPStatus(response.status_code),
|
|
72
|
+
content=response.content,
|
|
73
|
+
headers=response.headers,
|
|
74
|
+
parsed=_parse_response(response=response),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def sync_detailed(
|
|
79
|
+
name_or_id: str,
|
|
80
|
+
memory_id: str,
|
|
81
|
+
*,
|
|
82
|
+
body: CascadeEditSuggestionsRequest,
|
|
83
|
+
) -> Response[List["CascadingEditSuggestion"]]:
|
|
84
|
+
"""Suggest Cascading Edits
|
|
85
|
+
|
|
86
|
+
Suggest nearby neighbors who might be mislabeled based on a memory's label change.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
name_or_id: The name or ID of the memoryset.
|
|
90
|
+
memory_id: The ID of the memory to base suggestions on.
|
|
91
|
+
auth_context: The authentication context containing the organization ID.
|
|
92
|
+
request: The request containing parameters for generating suggestions.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
name_or_id (str):
|
|
96
|
+
memory_id (str):
|
|
97
|
+
body (CascadeEditSuggestionsRequest):
|
|
98
|
+
|
|
99
|
+
Raises:
|
|
100
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
101
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
Response[List['CascadingEditSuggestion']]
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
kwargs = _get_kwargs(
|
|
108
|
+
name_or_id=name_or_id,
|
|
109
|
+
memory_id=memory_id,
|
|
110
|
+
body=body,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
with _client_context() as client:
|
|
114
|
+
response = client.get_httpx_client().request(
|
|
115
|
+
**kwargs,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
return _build_response(response=response)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def sync(
|
|
122
|
+
name_or_id: str,
|
|
123
|
+
memory_id: str,
|
|
124
|
+
*,
|
|
125
|
+
body: CascadeEditSuggestionsRequest,
|
|
126
|
+
) -> List["CascadingEditSuggestion"]:
|
|
127
|
+
"""Suggest Cascading Edits
|
|
128
|
+
|
|
129
|
+
Suggest nearby neighbors who might be mislabeled based on a memory's label change.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
name_or_id: The name or ID of the memoryset.
|
|
133
|
+
memory_id: The ID of the memory to base suggestions on.
|
|
134
|
+
auth_context: The authentication context containing the organization ID.
|
|
135
|
+
request: The request containing parameters for generating suggestions.
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
name_or_id (str):
|
|
139
|
+
memory_id (str):
|
|
140
|
+
body (CascadeEditSuggestionsRequest):
|
|
141
|
+
|
|
142
|
+
Raises:
|
|
143
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
144
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
List['CascadingEditSuggestion']
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
return sync_detailed(
|
|
151
|
+
name_or_id=name_or_id,
|
|
152
|
+
memory_id=memory_id,
|
|
153
|
+
body=body,
|
|
154
|
+
).parsed
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
async def asyncio_detailed(
|
|
158
|
+
name_or_id: str,
|
|
159
|
+
memory_id: str,
|
|
160
|
+
*,
|
|
161
|
+
body: CascadeEditSuggestionsRequest,
|
|
162
|
+
) -> Response[List["CascadingEditSuggestion"]]:
|
|
163
|
+
"""Suggest Cascading Edits
|
|
164
|
+
|
|
165
|
+
Suggest nearby neighbors who might be mislabeled based on a memory's label change.
|
|
166
|
+
|
|
167
|
+
Args:
|
|
168
|
+
name_or_id: The name or ID of the memoryset.
|
|
169
|
+
memory_id: The ID of the memory to base suggestions on.
|
|
170
|
+
auth_context: The authentication context containing the organization ID.
|
|
171
|
+
request: The request containing parameters for generating suggestions.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
name_or_id (str):
|
|
175
|
+
memory_id (str):
|
|
176
|
+
body (CascadeEditSuggestionsRequest):
|
|
177
|
+
|
|
178
|
+
Raises:
|
|
179
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
180
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
Response[List['CascadingEditSuggestion']]
|
|
184
|
+
"""
|
|
185
|
+
|
|
186
|
+
kwargs = _get_kwargs(
|
|
187
|
+
name_or_id=name_or_id,
|
|
188
|
+
memory_id=memory_id,
|
|
189
|
+
body=body,
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
with _client_context() as client:
|
|
193
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
194
|
+
|
|
195
|
+
return _build_response(response=response)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
async def asyncio(
|
|
199
|
+
name_or_id: str,
|
|
200
|
+
memory_id: str,
|
|
201
|
+
*,
|
|
202
|
+
body: CascadeEditSuggestionsRequest,
|
|
203
|
+
) -> List["CascadingEditSuggestion"]:
|
|
204
|
+
"""Suggest Cascading Edits
|
|
205
|
+
|
|
206
|
+
Suggest nearby neighbors who might be mislabeled based on a memory's label change.
|
|
207
|
+
|
|
208
|
+
Args:
|
|
209
|
+
name_or_id: The name or ID of the memoryset.
|
|
210
|
+
memory_id: The ID of the memory to base suggestions on.
|
|
211
|
+
auth_context: The authentication context containing the organization ID.
|
|
212
|
+
request: The request containing parameters for generating suggestions.
|
|
213
|
+
|
|
214
|
+
Args:
|
|
215
|
+
name_or_id (str):
|
|
216
|
+
memory_id (str):
|
|
217
|
+
body (CascadeEditSuggestionsRequest):
|
|
218
|
+
|
|
219
|
+
Raises:
|
|
220
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
221
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
222
|
+
|
|
223
|
+
Returns:
|
|
224
|
+
List['CascadingEditSuggestion']
|
|
225
|
+
"""
|
|
226
|
+
|
|
227
|
+
return (
|
|
228
|
+
await asyncio_detailed(
|
|
229
|
+
name_or_id=name_or_id,
|
|
230
|
+
memory_id=memory_id,
|
|
231
|
+
body=body,
|
|
232
|
+
)
|
|
233
|
+
).parsed
|
|
@@ -6,6 +6,8 @@ from .api_key_metadata_scope_item import ApiKeyMetadataScopeItem
|
|
|
6
6
|
from .base_label_prediction_result import BaseLabelPredictionResult
|
|
7
7
|
from .base_model import BaseModel
|
|
8
8
|
from .body_create_datasource_datasource_post import BodyCreateDatasourceDatasourcePost
|
|
9
|
+
from .cascade_edit_suggestions_request import CascadeEditSuggestionsRequest
|
|
10
|
+
from .cascading_edit_suggestion import CascadingEditSuggestion
|
|
9
11
|
from .classification_evaluation_result import ClassificationEvaluationResult
|
|
10
12
|
from .clone_labeled_memoryset_request import CloneLabeledMemorysetRequest
|
|
11
13
|
from .cluster_metrics import ClusterMetrics
|
|
@@ -118,6 +120,8 @@ __all__ = (
|
|
|
118
120
|
"BaseLabelPredictionResult",
|
|
119
121
|
"BaseModel",
|
|
120
122
|
"BodyCreateDatasourceDatasourcePost",
|
|
123
|
+
"CascadeEditSuggestionsRequest",
|
|
124
|
+
"CascadingEditSuggestion",
|
|
121
125
|
"ClassificationEvaluationResult",
|
|
122
126
|
"CloneLabeledMemorysetRequest",
|
|
123
127
|
"ClusterMetrics",
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This file is generated by the openapi-python-client tool via the generate_api_client.py script
|
|
3
|
+
|
|
4
|
+
It is a customized template from the openapi-python-client tool's default template:
|
|
5
|
+
https://github.com/openapi-generators/openapi-python-client/blob/861ef5622f10fc96d240dc9becb0edf94e61446c/openapi_python_client/templates/model.py.jinja
|
|
6
|
+
|
|
7
|
+
The main change is:
|
|
8
|
+
- Fix typing issues
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
# flake8: noqa: C901
|
|
12
|
+
|
|
13
|
+
from typing import Any, Type, TypeVar, Union, cast
|
|
14
|
+
|
|
15
|
+
from attrs import define as _attrs_define
|
|
16
|
+
from attrs import field as _attrs_field
|
|
17
|
+
|
|
18
|
+
from ..types import UNSET, Unset
|
|
19
|
+
|
|
20
|
+
T = TypeVar("T", bound="CascadeEditSuggestionsRequest")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@_attrs_define
|
|
24
|
+
class CascadeEditSuggestionsRequest:
|
|
25
|
+
"""
|
|
26
|
+
Attributes:
|
|
27
|
+
old_label (int):
|
|
28
|
+
new_label (int):
|
|
29
|
+
max_neighbors (Union[Unset, int]): Default: 50.
|
|
30
|
+
max_validation_neighbors (Union[Unset, int]): Default: 10.
|
|
31
|
+
similarity_threshold (Union[None, Unset, float]):
|
|
32
|
+
only_if_has_old_label (Union[Unset, bool]): Default: True.
|
|
33
|
+
exclude_if_new_label (Union[Unset, bool]): Default: True.
|
|
34
|
+
suggestion_cooldown_time (Union[Unset, float]): Default: 86400.0.
|
|
35
|
+
label_confirmation_cooldown_time (Union[Unset, float]): Default: 604800.0.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
old_label: int
|
|
39
|
+
new_label: int
|
|
40
|
+
max_neighbors: Union[Unset, int] = 50
|
|
41
|
+
max_validation_neighbors: Union[Unset, int] = 10
|
|
42
|
+
similarity_threshold: Union[None, Unset, float] = UNSET
|
|
43
|
+
only_if_has_old_label: Union[Unset, bool] = True
|
|
44
|
+
exclude_if_new_label: Union[Unset, bool] = True
|
|
45
|
+
suggestion_cooldown_time: Union[Unset, float] = 86400.0
|
|
46
|
+
label_confirmation_cooldown_time: Union[Unset, float] = 604800.0
|
|
47
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
48
|
+
|
|
49
|
+
def to_dict(self) -> dict[str, Any]:
|
|
50
|
+
old_label = self.old_label
|
|
51
|
+
|
|
52
|
+
new_label = self.new_label
|
|
53
|
+
|
|
54
|
+
max_neighbors = self.max_neighbors
|
|
55
|
+
|
|
56
|
+
max_validation_neighbors = self.max_validation_neighbors
|
|
57
|
+
|
|
58
|
+
similarity_threshold: Union[None, Unset, float]
|
|
59
|
+
if isinstance(self.similarity_threshold, Unset):
|
|
60
|
+
similarity_threshold = UNSET
|
|
61
|
+
else:
|
|
62
|
+
similarity_threshold = self.similarity_threshold
|
|
63
|
+
|
|
64
|
+
only_if_has_old_label = self.only_if_has_old_label
|
|
65
|
+
|
|
66
|
+
exclude_if_new_label = self.exclude_if_new_label
|
|
67
|
+
|
|
68
|
+
suggestion_cooldown_time = self.suggestion_cooldown_time
|
|
69
|
+
|
|
70
|
+
label_confirmation_cooldown_time = self.label_confirmation_cooldown_time
|
|
71
|
+
|
|
72
|
+
field_dict: dict[str, Any] = {}
|
|
73
|
+
field_dict.update(self.additional_properties)
|
|
74
|
+
field_dict.update(
|
|
75
|
+
{
|
|
76
|
+
"old_label": old_label,
|
|
77
|
+
"new_label": new_label,
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
if max_neighbors is not UNSET:
|
|
81
|
+
field_dict["max_neighbors"] = max_neighbors
|
|
82
|
+
if max_validation_neighbors is not UNSET:
|
|
83
|
+
field_dict["max_validation_neighbors"] = max_validation_neighbors
|
|
84
|
+
if similarity_threshold is not UNSET:
|
|
85
|
+
field_dict["similarity_threshold"] = similarity_threshold
|
|
86
|
+
if only_if_has_old_label is not UNSET:
|
|
87
|
+
field_dict["only_if_has_old_label"] = only_if_has_old_label
|
|
88
|
+
if exclude_if_new_label is not UNSET:
|
|
89
|
+
field_dict["exclude_if_new_label"] = exclude_if_new_label
|
|
90
|
+
if suggestion_cooldown_time is not UNSET:
|
|
91
|
+
field_dict["suggestion_cooldown_time"] = suggestion_cooldown_time
|
|
92
|
+
if label_confirmation_cooldown_time is not UNSET:
|
|
93
|
+
field_dict["label_confirmation_cooldown_time"] = label_confirmation_cooldown_time
|
|
94
|
+
|
|
95
|
+
return field_dict
|
|
96
|
+
|
|
97
|
+
@classmethod
|
|
98
|
+
def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
|
|
99
|
+
d = src_dict.copy()
|
|
100
|
+
old_label = d.pop("old_label")
|
|
101
|
+
|
|
102
|
+
new_label = d.pop("new_label")
|
|
103
|
+
|
|
104
|
+
max_neighbors = d.pop("max_neighbors", UNSET)
|
|
105
|
+
|
|
106
|
+
max_validation_neighbors = d.pop("max_validation_neighbors", UNSET)
|
|
107
|
+
|
|
108
|
+
def _parse_similarity_threshold(data: object) -> Union[None, Unset, float]:
|
|
109
|
+
if data is None:
|
|
110
|
+
return data
|
|
111
|
+
if isinstance(data, Unset):
|
|
112
|
+
return data
|
|
113
|
+
return cast(Union[None, Unset, float], data)
|
|
114
|
+
|
|
115
|
+
similarity_threshold = _parse_similarity_threshold(d.pop("similarity_threshold", UNSET))
|
|
116
|
+
|
|
117
|
+
only_if_has_old_label = d.pop("only_if_has_old_label", UNSET)
|
|
118
|
+
|
|
119
|
+
exclude_if_new_label = d.pop("exclude_if_new_label", UNSET)
|
|
120
|
+
|
|
121
|
+
suggestion_cooldown_time = d.pop("suggestion_cooldown_time", UNSET)
|
|
122
|
+
|
|
123
|
+
label_confirmation_cooldown_time = d.pop("label_confirmation_cooldown_time", UNSET)
|
|
124
|
+
|
|
125
|
+
cascade_edit_suggestions_request = cls(
|
|
126
|
+
old_label=old_label,
|
|
127
|
+
new_label=new_label,
|
|
128
|
+
max_neighbors=max_neighbors,
|
|
129
|
+
max_validation_neighbors=max_validation_neighbors,
|
|
130
|
+
similarity_threshold=similarity_threshold,
|
|
131
|
+
only_if_has_old_label=only_if_has_old_label,
|
|
132
|
+
exclude_if_new_label=exclude_if_new_label,
|
|
133
|
+
suggestion_cooldown_time=suggestion_cooldown_time,
|
|
134
|
+
label_confirmation_cooldown_time=label_confirmation_cooldown_time,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
cascade_edit_suggestions_request.additional_properties = d
|
|
138
|
+
return cascade_edit_suggestions_request
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
def additional_keys(self) -> list[str]:
|
|
142
|
+
return list(self.additional_properties.keys())
|
|
143
|
+
|
|
144
|
+
def __getitem__(self, key: str) -> Any:
|
|
145
|
+
return self.additional_properties[key]
|
|
146
|
+
|
|
147
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
148
|
+
self.additional_properties[key] = value
|
|
149
|
+
|
|
150
|
+
def __delitem__(self, key: str) -> None:
|
|
151
|
+
del self.additional_properties[key]
|
|
152
|
+
|
|
153
|
+
def __contains__(self, key: str) -> bool:
|
|
154
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This file is generated by the openapi-python-client tool via the generate_api_client.py script
|
|
3
|
+
|
|
4
|
+
It is a customized template from the openapi-python-client tool's default template:
|
|
5
|
+
https://github.com/openapi-generators/openapi-python-client/blob/861ef5622f10fc96d240dc9becb0edf94e61446c/openapi_python_client/templates/model.py.jinja
|
|
6
|
+
|
|
7
|
+
The main change is:
|
|
8
|
+
- Fix typing issues
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
# flake8: noqa: C901
|
|
12
|
+
|
|
13
|
+
from typing import TYPE_CHECKING, Any, Type, TypeVar
|
|
14
|
+
|
|
15
|
+
from attrs import define as _attrs_define
|
|
16
|
+
from attrs import field as _attrs_field
|
|
17
|
+
|
|
18
|
+
if TYPE_CHECKING:
|
|
19
|
+
from ..models.labeled_memory_lookup import LabeledMemoryLookup
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
T = TypeVar("T", bound="CascadingEditSuggestion")
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@_attrs_define
|
|
26
|
+
class CascadingEditSuggestion:
|
|
27
|
+
"""
|
|
28
|
+
Attributes:
|
|
29
|
+
neighbor (LabeledMemoryLookup): Single labeled memory lookup result.
|
|
30
|
+
suggested_label (int):
|
|
31
|
+
lookup_score (float):
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
neighbor: "LabeledMemoryLookup"
|
|
35
|
+
suggested_label: int
|
|
36
|
+
lookup_score: float
|
|
37
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
38
|
+
|
|
39
|
+
def to_dict(self) -> dict[str, Any]:
|
|
40
|
+
neighbor = self.neighbor.to_dict()
|
|
41
|
+
|
|
42
|
+
suggested_label = self.suggested_label
|
|
43
|
+
|
|
44
|
+
lookup_score = self.lookup_score
|
|
45
|
+
|
|
46
|
+
field_dict: dict[str, Any] = {}
|
|
47
|
+
field_dict.update(self.additional_properties)
|
|
48
|
+
field_dict.update(
|
|
49
|
+
{
|
|
50
|
+
"neighbor": neighbor,
|
|
51
|
+
"suggested_label": suggested_label,
|
|
52
|
+
"lookup_score": lookup_score,
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
return field_dict
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def from_dict(cls: Type[T], src_dict: dict[str, Any]) -> T:
|
|
60
|
+
from ..models.labeled_memory_lookup import LabeledMemoryLookup
|
|
61
|
+
|
|
62
|
+
d = src_dict.copy()
|
|
63
|
+
neighbor = LabeledMemoryLookup.from_dict(d.pop("neighbor"))
|
|
64
|
+
|
|
65
|
+
suggested_label = d.pop("suggested_label")
|
|
66
|
+
|
|
67
|
+
lookup_score = d.pop("lookup_score")
|
|
68
|
+
|
|
69
|
+
cascading_edit_suggestion = cls(
|
|
70
|
+
neighbor=neighbor,
|
|
71
|
+
suggested_label=suggested_label,
|
|
72
|
+
lookup_score=lookup_score,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
cascading_edit_suggestion.additional_properties = d
|
|
76
|
+
return cascading_edit_suggestion
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def additional_keys(self) -> list[str]:
|
|
80
|
+
return list(self.additional_properties.keys())
|
|
81
|
+
|
|
82
|
+
def __getitem__(self, key: str) -> Any:
|
|
83
|
+
return self.additional_properties[key]
|
|
84
|
+
|
|
85
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
86
|
+
self.additional_properties[key] = value
|
|
87
|
+
|
|
88
|
+
def __delitem__(self, key: str) -> None:
|
|
89
|
+
del self.additional_properties[key]
|
|
90
|
+
|
|
91
|
+
def __contains__(self, key: str) -> bool:
|
|
92
|
+
return key in self.additional_properties
|
|
@@ -15,6 +15,8 @@ from typing import TYPE_CHECKING, Any, Dict, Type, TypeVar, Union, cast
|
|
|
15
15
|
from attrs import define as _attrs_define
|
|
16
16
|
from attrs import field as _attrs_field
|
|
17
17
|
|
|
18
|
+
from ..types import UNSET, Unset
|
|
19
|
+
|
|
18
20
|
if TYPE_CHECKING:
|
|
19
21
|
from ..models.precision_recall_curve import PrecisionRecallCurve
|
|
20
22
|
from ..models.roc_curve import ROCCurve
|
|
@@ -32,6 +34,9 @@ class ClassificationEvaluationResult:
|
|
|
32
34
|
loss (float):
|
|
33
35
|
precision_recall_curve (Union['PrecisionRecallCurve', None]):
|
|
34
36
|
roc_curve (Union['ROCCurve', None]):
|
|
37
|
+
anomaly_score_mean (Union[None, Unset, float]):
|
|
38
|
+
anomaly_score_median (Union[None, Unset, float]):
|
|
39
|
+
anomaly_score_variance (Union[None, Unset, float]):
|
|
35
40
|
"""
|
|
36
41
|
|
|
37
42
|
f1_score: float
|
|
@@ -39,6 +44,9 @@ class ClassificationEvaluationResult:
|
|
|
39
44
|
loss: float
|
|
40
45
|
precision_recall_curve: Union["PrecisionRecallCurve", None]
|
|
41
46
|
roc_curve: Union["ROCCurve", None]
|
|
47
|
+
anomaly_score_mean: Union[None, Unset, float] = UNSET
|
|
48
|
+
anomaly_score_median: Union[None, Unset, float] = UNSET
|
|
49
|
+
anomaly_score_variance: Union[None, Unset, float] = UNSET
|
|
42
50
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
43
51
|
|
|
44
52
|
def to_dict(self) -> dict[str, Any]:
|
|
@@ -63,6 +71,24 @@ class ClassificationEvaluationResult:
|
|
|
63
71
|
else:
|
|
64
72
|
roc_curve = self.roc_curve
|
|
65
73
|
|
|
74
|
+
anomaly_score_mean: Union[None, Unset, float]
|
|
75
|
+
if isinstance(self.anomaly_score_mean, Unset):
|
|
76
|
+
anomaly_score_mean = UNSET
|
|
77
|
+
else:
|
|
78
|
+
anomaly_score_mean = self.anomaly_score_mean
|
|
79
|
+
|
|
80
|
+
anomaly_score_median: Union[None, Unset, float]
|
|
81
|
+
if isinstance(self.anomaly_score_median, Unset):
|
|
82
|
+
anomaly_score_median = UNSET
|
|
83
|
+
else:
|
|
84
|
+
anomaly_score_median = self.anomaly_score_median
|
|
85
|
+
|
|
86
|
+
anomaly_score_variance: Union[None, Unset, float]
|
|
87
|
+
if isinstance(self.anomaly_score_variance, Unset):
|
|
88
|
+
anomaly_score_variance = UNSET
|
|
89
|
+
else:
|
|
90
|
+
anomaly_score_variance = self.anomaly_score_variance
|
|
91
|
+
|
|
66
92
|
field_dict: dict[str, Any] = {}
|
|
67
93
|
field_dict.update(self.additional_properties)
|
|
68
94
|
field_dict.update(
|
|
@@ -74,6 +100,12 @@ class ClassificationEvaluationResult:
|
|
|
74
100
|
"roc_curve": roc_curve,
|
|
75
101
|
}
|
|
76
102
|
)
|
|
103
|
+
if anomaly_score_mean is not UNSET:
|
|
104
|
+
field_dict["anomaly_score_mean"] = anomaly_score_mean
|
|
105
|
+
if anomaly_score_median is not UNSET:
|
|
106
|
+
field_dict["anomaly_score_median"] = anomaly_score_median
|
|
107
|
+
if anomaly_score_variance is not UNSET:
|
|
108
|
+
field_dict["anomaly_score_variance"] = anomaly_score_variance
|
|
77
109
|
|
|
78
110
|
return field_dict
|
|
79
111
|
|
|
@@ -119,12 +151,42 @@ class ClassificationEvaluationResult:
|
|
|
119
151
|
|
|
120
152
|
roc_curve = _parse_roc_curve(d.pop("roc_curve"))
|
|
121
153
|
|
|
154
|
+
def _parse_anomaly_score_mean(data: object) -> Union[None, Unset, float]:
|
|
155
|
+
if data is None:
|
|
156
|
+
return data
|
|
157
|
+
if isinstance(data, Unset):
|
|
158
|
+
return data
|
|
159
|
+
return cast(Union[None, Unset, float], data)
|
|
160
|
+
|
|
161
|
+
anomaly_score_mean = _parse_anomaly_score_mean(d.pop("anomaly_score_mean", UNSET))
|
|
162
|
+
|
|
163
|
+
def _parse_anomaly_score_median(data: object) -> Union[None, Unset, float]:
|
|
164
|
+
if data is None:
|
|
165
|
+
return data
|
|
166
|
+
if isinstance(data, Unset):
|
|
167
|
+
return data
|
|
168
|
+
return cast(Union[None, Unset, float], data)
|
|
169
|
+
|
|
170
|
+
anomaly_score_median = _parse_anomaly_score_median(d.pop("anomaly_score_median", UNSET))
|
|
171
|
+
|
|
172
|
+
def _parse_anomaly_score_variance(data: object) -> Union[None, Unset, float]:
|
|
173
|
+
if data is None:
|
|
174
|
+
return data
|
|
175
|
+
if isinstance(data, Unset):
|
|
176
|
+
return data
|
|
177
|
+
return cast(Union[None, Unset, float], data)
|
|
178
|
+
|
|
179
|
+
anomaly_score_variance = _parse_anomaly_score_variance(d.pop("anomaly_score_variance", UNSET))
|
|
180
|
+
|
|
122
181
|
classification_evaluation_result = cls(
|
|
123
182
|
f1_score=f1_score,
|
|
124
183
|
accuracy=accuracy,
|
|
125
184
|
loss=loss,
|
|
126
185
|
precision_recall_curve=precision_recall_curve,
|
|
127
186
|
roc_curve=roc_curve,
|
|
187
|
+
anomaly_score_mean=anomaly_score_mean,
|
|
188
|
+
anomaly_score_median=anomaly_score_median,
|
|
189
|
+
anomaly_score_variance=anomaly_score_variance,
|
|
128
190
|
)
|
|
129
191
|
|
|
130
192
|
classification_evaluation_result.additional_properties = d
|
|
@@ -38,6 +38,7 @@ class LabelPredictionMemoryLookup:
|
|
|
38
38
|
memory_version (int):
|
|
39
39
|
created_at (datetime.datetime):
|
|
40
40
|
updated_at (datetime.datetime):
|
|
41
|
+
edited_at (datetime.datetime):
|
|
41
42
|
metrics (MemoryMetrics):
|
|
42
43
|
label (int):
|
|
43
44
|
label_name (Union[None, str]):
|
|
@@ -54,6 +55,7 @@ class LabelPredictionMemoryLookup:
|
|
|
54
55
|
memory_version: int
|
|
55
56
|
created_at: datetime.datetime
|
|
56
57
|
updated_at: datetime.datetime
|
|
58
|
+
edited_at: datetime.datetime
|
|
57
59
|
metrics: "MemoryMetrics"
|
|
58
60
|
label: int
|
|
59
61
|
label_name: Union[None, str]
|
|
@@ -81,6 +83,8 @@ class LabelPredictionMemoryLookup:
|
|
|
81
83
|
|
|
82
84
|
updated_at = self.updated_at.isoformat()
|
|
83
85
|
|
|
86
|
+
edited_at = self.edited_at.isoformat()
|
|
87
|
+
|
|
84
88
|
metrics = self.metrics.to_dict()
|
|
85
89
|
|
|
86
90
|
label = self.label
|
|
@@ -106,6 +110,7 @@ class LabelPredictionMemoryLookup:
|
|
|
106
110
|
"memory_version": memory_version,
|
|
107
111
|
"created_at": created_at,
|
|
108
112
|
"updated_at": updated_at,
|
|
113
|
+
"edited_at": edited_at,
|
|
109
114
|
"metrics": metrics,
|
|
110
115
|
"label": label,
|
|
111
116
|
"label_name": label_name,
|
|
@@ -148,6 +153,8 @@ class LabelPredictionMemoryLookup:
|
|
|
148
153
|
|
|
149
154
|
updated_at = isoparse(d.pop("updated_at"))
|
|
150
155
|
|
|
156
|
+
edited_at = isoparse(d.pop("edited_at"))
|
|
157
|
+
|
|
151
158
|
metrics = MemoryMetrics.from_dict(d.pop("metrics"))
|
|
152
159
|
|
|
153
160
|
label = d.pop("label")
|
|
@@ -174,6 +181,7 @@ class LabelPredictionMemoryLookup:
|
|
|
174
181
|
memory_version=memory_version,
|
|
175
182
|
created_at=created_at,
|
|
176
183
|
updated_at=updated_at,
|
|
184
|
+
edited_at=edited_at,
|
|
177
185
|
metrics=metrics,
|
|
178
186
|
label=label,
|
|
179
187
|
label_name=label_name,
|