dyff-schema 0.5.3__py3-none-any.whl → 0.7.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.
@@ -1097,6 +1097,16 @@ class InferenceSessionAndToken(DyffSchemaBaseModel):
1097
1097
  token: str
1098
1098
 
1099
1099
 
1100
+ class InferenceSessionReference(DyffSchemaBaseModel):
1101
+ session: str = pydantic.Field(
1102
+ description="The ID of a running inference session.",
1103
+ )
1104
+
1105
+ interface: InferenceInterface = pydantic.Field(
1106
+ description="How to move data in and out of the service."
1107
+ )
1108
+
1109
+
1100
1110
  class DatasetFilter(DyffSchemaBaseModel):
1101
1111
  """A rule for restrcting which instances in a Dataset are returned."""
1102
1112
 
@@ -1134,10 +1144,20 @@ class Evaluation(DyffEntity, EvaluationBase):
1134
1144
  kind: Literal["Evaluation"] = Entities.Evaluation.value
1135
1145
 
1136
1146
  inferenceSession: InferenceSessionSpec = pydantic.Field(
1137
- description="Specification of the InferenceSession that will perform inference for the evaluation.",
1147
+ description="Specification of the InferenceSession that will perform"
1148
+ " inference for the evaluation.",
1149
+ )
1150
+
1151
+ inferenceSessionReference: Optional[str] = pydantic.Field(
1152
+ default=None,
1153
+ description="ID of a running inference session that will be used"
1154
+ " for the evaluation instead of starting a new one.",
1138
1155
  )
1139
1156
 
1140
1157
  def dependencies(self) -> list[str]:
1158
+ # TODO: It would be nice if the session could be a dependency,
1159
+ # so that the client doesn't start until the session is ready, but
1160
+ # dyff-orchestrator can't handle dependencies on sessions currently.
1141
1161
  return [self.dataset, self.inferenceSession.inferenceService.id]
1142
1162
 
1143
1163
  def resource_allocation(self) -> Optional[ResourceAllocation]:
@@ -1867,6 +1887,7 @@ __all__ = [
1867
1887
  "InferenceSession",
1868
1888
  "InferenceSessionAndToken",
1869
1889
  "InferenceSessionBase",
1890
+ "InferenceSessionReference",
1870
1891
  "InferenceSessionSpec",
1871
1892
  "Label",
1872
1893
  "LabelKey",
@@ -13,6 +13,7 @@ in response.
13
13
  """
14
14
 
15
15
 
16
+ from datetime import datetime
16
17
  from typing import Any, Optional, Union
17
18
 
18
19
  import pydantic
@@ -65,6 +66,14 @@ class InferenceSessionCreateRequest(DyffEntityCreateRequest, InferenceSessionBas
65
66
  inferenceService: str = pydantic.Field(description="InferenceService ID")
66
67
 
67
68
 
69
+ class InferenceSessionTokenCreateRequest(SchemaVersion, DyffSchemaBaseModel):
70
+ expires: Optional[datetime] = pydantic.Field(
71
+ default=None,
72
+ description="Expiration time of the token. Must be <= expiration time"
73
+ " of session. Default: expiration time of session.",
74
+ )
75
+
76
+
68
77
  class EvaluationInferenceSessionRequest(InferenceSessionBase):
69
78
  inferenceService: str = pydantic.Field(description="InferenceService ID")
70
79
 
@@ -73,10 +82,27 @@ class EvaluationCreateRequest(DyffEntityCreateRequest, EvaluationBase):
73
82
  """A description of how to run an InferenceService on a Dataset to obtain a set of
74
83
  evaluation results."""
75
84
 
76
- inferenceSession: EvaluationInferenceSessionRequest = pydantic.Field(
85
+ inferenceSession: Optional[EvaluationInferenceSessionRequest] = pydantic.Field(
86
+ default=None,
77
87
  description="Specification of the InferenceSession that will perform inference for the evaluation.",
78
88
  )
79
89
 
90
+ inferenceSessionReference: Optional[str] = pydantic.Field(
91
+ default=None,
92
+ description="The ID of a running inference session that will be used"
93
+ " for the evaluation, instead of starting a new one.",
94
+ )
95
+
96
+ @pydantic.root_validator
97
+ def check_session_exactly_one(cls, values):
98
+ session = values.get("inferenceSession") is not None
99
+ session_ref = values.get("inferenceSessionReference") is not None
100
+ if not (session ^ session_ref):
101
+ raise ValueError(
102
+ "must specify exactly one of {inferenceSession, inferenceSessionReference}"
103
+ )
104
+ return values
105
+
80
106
 
81
107
  class MethodCreateRequest(DyffEntityCreateRequest, MethodBase):
82
108
  pass
@@ -224,6 +250,7 @@ __all__ = [
224
250
  "InferenceServiceQueryRequest",
225
251
  "InferenceSessionCreateRequest",
226
252
  "InferenceSessionQueryRequest",
253
+ "InferenceSessionTokenCreateRequest",
227
254
  "LabelUpdateRequest",
228
255
  "MeasurementQueryRequest",
229
256
  "MethodCreateRequest",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dyff-schema
3
- Version: 0.5.3
3
+ Version: 0.7.0
4
4
  Summary: Data models for the Dyff AI auditing platform.
5
5
  Author-email: Digital Safety Research Institute <contact@dsri.org>
6
6
  License: Apache-2.0
@@ -21,8 +21,8 @@ dyff/schema/v0/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs,92
21
21
  dyff/schema/v0/r1/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs,92
22
22
  dyff/schema/v0/r1/adapters.py,sha256=2t2oxsnGfSEDKKDIEYw4qqLXMH7qlFIwPVuLyUmbsHs,23552
23
23
  dyff/schema/v0/r1/base.py,sha256=g_wqh4OU_9ftMHovVxPtdeup4O5MZi422v3eZH99ZQI,17139
24
- dyff/schema/v0/r1/platform.py,sha256=YTkQpjkwjf2L0EKu69HvdzqRJOsJCkyDhagzosSz6tE,59933
25
- dyff/schema/v0/r1/requests.py,sha256=nhdYAzsZGoXTEcV1BYvzwuqJbBkFbJ5ZhZly8206xns,7814
24
+ dyff/schema/v0/r1/platform.py,sha256=2QcXlSxPZDLqbICoAvwebXcRf3ssvK_X6MJRqxx3AXI,60712
25
+ dyff/schema/v0/r1/requests.py,sha256=OKOBk4fRFCEVEd4cID4DXAY9yQug7kC5da-GXW54U00,8860
26
26
  dyff/schema/v0/r1/test.py,sha256=X6dUyVd5svcPCI-PBMOAqEfK9jv3bRDvkQTJzwS96c0,10720
27
27
  dyff/schema/v0/r1/version.py,sha256=isKAGuGxsdru8vDaYmI4YiZdJOu_wNxXK7u6QzD6FE4,392
28
28
  dyff/schema/v0/r1/dataset/__init__.py,sha256=LbVlkO2asyGYBKk2z49xjJYTM-pu9y9e4eQDXgTDLnM,2553
@@ -33,9 +33,9 @@ dyff/schema/v0/r1/dataset/text.py,sha256=nLIn91Zlt0tNdXUklSgjJ-kEDxoPX32ISLkiv2D
33
33
  dyff/schema/v0/r1/dataset/vision.py,sha256=aIe0fbfM_g3DsrDTdg2K803YKLjZBpurM_VJcJFuZLc,369
34
34
  dyff/schema/v0/r1/io/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs,92
35
35
  dyff/schema/v0/r1/io/vllm.py,sha256=CUE9y8KthtUI7sD49S875rDmPvKotSXVIRaBS79aBZs,5320
36
- dyff_schema-0.5.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
37
- dyff_schema-0.5.3.dist-info/METADATA,sha256=XOHzqp_qBrhUXXhtWc4SBa70v2lzujLNKGKpXY-sZGo,3459
38
- dyff_schema-0.5.3.dist-info/NOTICE,sha256=YONACu0s_Ui6jNi-wtEsVQbTU1JIkh8wvLH6d1-Ni_w,43
39
- dyff_schema-0.5.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
40
- dyff_schema-0.5.3.dist-info/top_level.txt,sha256=9e3VVdeX73t_sUJOPQPCcGtYO1JhoErhHIi3WoWGcFI,5
41
- dyff_schema-0.5.3.dist-info/RECORD,,
36
+ dyff_schema-0.7.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
37
+ dyff_schema-0.7.0.dist-info/METADATA,sha256=YmFc5JSsf50GgMl1jUv4Epb-idVIs26oj1_ZuXKzpow,3459
38
+ dyff_schema-0.7.0.dist-info/NOTICE,sha256=YONACu0s_Ui6jNi-wtEsVQbTU1JIkh8wvLH6d1-Ni_w,43
39
+ dyff_schema-0.7.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
40
+ dyff_schema-0.7.0.dist-info/top_level.txt,sha256=9e3VVdeX73t_sUJOPQPCcGtYO1JhoErhHIi3WoWGcFI,5
41
+ dyff_schema-0.7.0.dist-info/RECORD,,