dyff-schema 0.20.0__py3-none-any.whl → 0.20.1__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 dyff-schema might be problematic. Click here for more details.

@@ -38,6 +38,8 @@ from .platform import (
38
38
  ModelSpec,
39
39
  ModuleBase,
40
40
  ReportBase,
41
+ summary_maxlen,
42
+ title_maxlen,
41
43
  )
42
44
  from .version import SchemaVersion
43
45
 
@@ -94,7 +96,28 @@ class AnalysisCreateRequest(DyffEntityCreateRequest, AnalysisBase):
94
96
 
95
97
 
96
98
  class ConcernCreateRequest(DyffEntityCreateRequest, ConcernBase):
97
- pass
99
+ @pydantic.validator("documentation", check_fields=False)
100
+ def _validate_documentation(
101
+ cls, documentation: DocumentationBase
102
+ ) -> DocumentationBase:
103
+ # TODO: This has to be a validator function because we can't apply the
104
+ # contraint to DocumentationBase, since there are already entities
105
+ # that violate the constraints in the data store. Fix in Schema v1.
106
+ if (
107
+ documentation.title is not None
108
+ and len(documentation.title) > title_maxlen()
109
+ ):
110
+ raise ValueError(
111
+ f".documentation.title must have length < {title_maxlen()}"
112
+ )
113
+ if (
114
+ documentation.summary is not None
115
+ and len(documentation.summary) > summary_maxlen()
116
+ ):
117
+ raise ValueError(
118
+ f".documentation.summary must have length < {summary_maxlen()}"
119
+ )
120
+ return documentation
98
121
 
99
122
 
100
123
  class DatasetCreateRequest(DyffEntityCreateRequest, DatasetBase):
@@ -102,7 +125,23 @@ class DatasetCreateRequest(DyffEntityCreateRequest, DatasetBase):
102
125
 
103
126
 
104
127
  class DocumentationEditRequest(DyffRequestBase, DocumentationBase):
105
- pass
128
+ @pydantic.validator("title", check_fields=False)
129
+ def _validate_title(cls, title: Optional[str]) -> Optional[str]:
130
+ # TODO: This has to be a validator function because we can't apply the
131
+ # contraint to DocumentationBase, since there are already entities
132
+ # that violate the constraints in the data store. Fix in Schema v1.
133
+ if title is not None and len(title) > title_maxlen():
134
+ raise ValueError(f".title must have length < {title_maxlen()}")
135
+ return title
136
+
137
+ @pydantic.validator("summary", check_fields=False)
138
+ def _validate_summary(cls, summary: Optional[str]) -> Optional[str]:
139
+ # TODO: This has to be a validator function because we can't apply the
140
+ # contraint to DocumentationBase, since there are already entities
141
+ # that violate the constraints in the data store. Fix in Schema v1.
142
+ if summary is not None and len(summary) > summary_maxlen():
143
+ raise ValueError(f".summary must have length < {summary_maxlen()}")
144
+ return summary
106
145
 
107
146
 
108
147
  class InferenceServiceCreateRequest(DyffEntityCreateRequest, InferenceServiceBase):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dyff-schema
3
- Version: 0.20.0
3
+ Version: 0.20.1
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
@@ -25,7 +25,7 @@ dyff/schema/v0/r1/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs
25
25
  dyff/schema/v0/r1/adapters.py,sha256=2t2oxsnGfSEDKKDIEYw4qqLXMH7qlFIwPVuLyUmbsHs,23552
26
26
  dyff/schema/v0/r1/base.py,sha256=IpvlYDr6JjYo6tn8XW4C1Fpgd_uqzZGZsG_cuEn_gQs,19441
27
27
  dyff/schema/v0/r1/platform.py,sha256=bvROO9WEOV257C_QSWuWeDLCFegaYl116YvMP-AClUE,75609
28
- dyff/schema/v0/r1/requests.py,sha256=s31J0fegRm_7My_5Ut-qNQnXtMMVwlhOSWKf51h5u4g,13269
28
+ dyff/schema/v0/r1/requests.py,sha256=3aLqBchrwoFg18ZrVGU938Zo3B4G2o-zzHA2r7noEDc,15259
29
29
  dyff/schema/v0/r1/test.py,sha256=X6dUyVd5svcPCI-PBMOAqEfK9jv3bRDvkQTJzwS96c0,10720
30
30
  dyff/schema/v0/r1/version.py,sha256=isKAGuGxsdru8vDaYmI4YiZdJOu_wNxXK7u6QzD6FE4,392
31
31
  dyff/schema/v0/r1/dataset/__init__.py,sha256=LbVlkO2asyGYBKk2z49xjJYTM-pu9y9e4eQDXgTDLnM,2553
@@ -37,9 +37,9 @@ dyff/schema/v0/r1/dataset/text.py,sha256=nLIn91Zlt0tNdXUklSgjJ-kEDxoPX32ISLkiv2D
37
37
  dyff/schema/v0/r1/dataset/vision.py,sha256=aIe0fbfM_g3DsrDTdg2K803YKLjZBpurM_VJcJFuZLc,369
38
38
  dyff/schema/v0/r1/io/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs,92
39
39
  dyff/schema/v0/r1/io/vllm.py,sha256=CUE9y8KthtUI7sD49S875rDmPvKotSXVIRaBS79aBZs,5320
40
- dyff_schema-0.20.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
41
- dyff_schema-0.20.0.dist-info/METADATA,sha256=WkVYqNNDqfAfcdwnC5kkmYa2q86AYDVjhZcMD5Sn14k,3482
42
- dyff_schema-0.20.0.dist-info/NOTICE,sha256=YONACu0s_Ui6jNi-wtEsVQbTU1JIkh8wvLH6d1-Ni_w,43
43
- dyff_schema-0.20.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
44
- dyff_schema-0.20.0.dist-info/top_level.txt,sha256=9e3VVdeX73t_sUJOPQPCcGtYO1JhoErhHIi3WoWGcFI,5
45
- dyff_schema-0.20.0.dist-info/RECORD,,
40
+ dyff_schema-0.20.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
41
+ dyff_schema-0.20.1.dist-info/METADATA,sha256=RgL-FUplGCL93AiOnjWVkZ5m_QMygt6kRe2bBq4yp_g,3482
42
+ dyff_schema-0.20.1.dist-info/NOTICE,sha256=YONACu0s_Ui6jNi-wtEsVQbTU1JIkh8wvLH6d1-Ni_w,43
43
+ dyff_schema-0.20.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
44
+ dyff_schema-0.20.1.dist-info/top_level.txt,sha256=9e3VVdeX73t_sUJOPQPCcGtYO1JhoErhHIi3WoWGcFI,5
45
+ dyff_schema-0.20.1.dist-info/RECORD,,