dyff-schema 0.4.0__tar.gz → 0.5.1__tar.gz

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.
Files changed (55) hide show
  1. {dyff_schema-0.4.0/dyff_schema.egg-info → dyff_schema-0.5.1}/PKG-INFO +1 -1
  2. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/platform.py +111 -3
  3. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/requests.py +14 -2
  4. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/version.py +5 -5
  5. {dyff_schema-0.4.0 → dyff_schema-0.5.1/dyff_schema.egg-info}/PKG-INFO +1 -1
  6. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/.gitignore +0 -0
  7. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/.gitlab-ci.yml +0 -0
  8. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/.licenserc.yaml +0 -0
  9. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/.pre-commit-config.yaml +0 -0
  10. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/.prettierignore +0 -0
  11. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/.secrets.baseline +0 -0
  12. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/CODE_OF_CONDUCT.md +0 -0
  13. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/LICENSE +0 -0
  14. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/NOTICE +0 -0
  15. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/README.md +0 -0
  16. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/__init__.py +0 -0
  17. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/adapters.py +0 -0
  18. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/base.py +0 -0
  19. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/copydoc.py +0 -0
  20. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/dataset/__init__.py +0 -0
  21. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/dataset/arrow.py +0 -0
  22. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/dataset/binary.py +0 -0
  23. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/dataset/classification.py +0 -0
  24. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/dataset/text.py +0 -0
  25. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/dataset/vision.py +0 -0
  26. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/ids.py +0 -0
  27. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/io/__init__.py +0 -0
  28. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/io/vllm.py +0 -0
  29. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/platform.py +0 -0
  30. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/py.typed +0 -0
  31. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/quantity.py +0 -0
  32. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/requests.py +0 -0
  33. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/test.py +0 -0
  34. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/__init__.py +0 -0
  35. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/__init__.py +0 -0
  36. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/adapters.py +0 -0
  37. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/base.py +0 -0
  38. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/dataset/__init__.py +0 -0
  39. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/dataset/arrow.py +0 -0
  40. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/dataset/binary.py +0 -0
  41. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/dataset/classification.py +0 -0
  42. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/dataset/text.py +0 -0
  43. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/dataset/vision.py +0 -0
  44. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/io/__init__.py +0 -0
  45. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/io/vllm.py +0 -0
  46. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/v0/r1/test.py +0 -0
  47. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff/schema/version.py +0 -0
  48. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff_schema.egg-info/SOURCES.txt +0 -0
  49. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff_schema.egg-info/dependency_links.txt +0 -0
  50. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff_schema.egg-info/requires.txt +0 -0
  51. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/dyff_schema.egg-info/top_level.txt +0 -0
  52. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/makefile +0 -0
  53. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/pyproject.toml +0 -0
  54. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/setup.cfg +0 -0
  55. {dyff_schema-0.4.0 → dyff_schema-0.5.1}/tests/test_import.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dyff-schema
3
- Version: 0.4.0
3
+ Version: 0.5.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
@@ -30,7 +30,7 @@ from ... import named_data_schema, product_schema
30
30
  from ...version import SomeSchemaVersion
31
31
  from .base import DyffSchemaBaseModel
32
32
  from .dataset import arrow, make_item_type, make_response_type
33
- from .version import VERSION, Versioned
33
+ from .version import SCHEMA_VERSION, SchemaVersion
34
34
 
35
35
  SYSTEM_ATTRIBUTES = frozenset(["creationTime", "status", "reason"])
36
36
 
@@ -149,6 +149,7 @@ class Entities(str, enum.Enum):
149
149
  DataSource = "DataSource"
150
150
  Dataset = "Dataset"
151
151
  Evaluation = "Evaluation"
152
+ Family = "Family"
152
153
  InferenceService = "InferenceService"
153
154
  InferenceSession = "InferenceSession"
154
155
  Measurement = "Measurement"
@@ -157,6 +158,7 @@ class Entities(str, enum.Enum):
157
158
  Module = "Module"
158
159
  Report = "Report"
159
160
  SafetyCase = "SafetyCase"
161
+ Tag = "Tag"
160
162
 
161
163
 
162
164
  class Resources(str, enum.Enum):
@@ -168,6 +170,7 @@ class Resources(str, enum.Enum):
168
170
  Dataset = "datasets"
169
171
  DataSource = "datasources"
170
172
  Evaluation = "evaluations"
173
+ Family = "families"
171
174
  InferenceService = "inferenceservices"
172
175
  InferenceSession = "inferencesessions"
173
176
  Measurement = "measurements"
@@ -176,6 +179,7 @@ class Resources(str, enum.Enum):
176
179
  Module = "modules"
177
180
  Report = "reports"
178
181
  SafetyCase = "safetycases"
182
+ Tag = "tags"
179
183
 
180
184
  Task = "tasks"
181
185
  """
@@ -294,7 +298,96 @@ class Status(DyffSchemaBaseModel):
294
298
  )
295
299
 
296
300
 
297
- class DyffEntity(Status, Labeled, Versioned, DyffModelWithID):
301
+ class Documentation(DyffSchemaBaseModel):
302
+ title: Optional[str] = pydantic.Field(
303
+ default=None,
304
+ description='A short plain string suitable as a title or "headline".',
305
+ )
306
+
307
+ summary: Optional[str] = pydantic.Field(
308
+ default=None,
309
+ description="A brief summary, suitable for display in"
310
+ " small UI elements. Interpreted as Markdown. Excessively long"
311
+ " summaries may be truncated in the UI, especially on small displays.",
312
+ )
313
+
314
+ fullPage: Optional[str] = pydantic.Field(
315
+ default=None,
316
+ description="Long-form documentation. Interpreted as"
317
+ " Markdown. There are no length constraints, but be reasonable.",
318
+ )
319
+
320
+
321
+ class Documented(DyffSchemaBaseModel):
322
+ documentation: Documentation = pydantic.Field(
323
+ default_factory=Documentation,
324
+ description="Documentation of the resource. The content is used to"
325
+ " populate various views in the web UI.",
326
+ )
327
+
328
+
329
+ class FamilyMemberKind(str, enum.Enum):
330
+ """The kinds of entities that can be members of a Family.
331
+
332
+ These are resources for which it makes sense to have different versions or variants
333
+ that evolve over time.
334
+ """
335
+
336
+ Dataset = "Dataset"
337
+ InferenceService = "InferenceService"
338
+ Method = "Method"
339
+ Model = "Model"
340
+ Module = "Module"
341
+
342
+
343
+ class FamilyMember(DyffSchemaBaseModel):
344
+ family: Optional[str] = pydantic.Field(
345
+ default=None,
346
+ description="ID of the Family to which the resource belongs.",
347
+ )
348
+
349
+
350
+ class TagBase(DyffSchemaBaseModel):
351
+ tag: str = pydantic.Field(
352
+ description="An interpretable identifier for the tag that is unique in"
353
+ " the context of the corresponding Family."
354
+ )
355
+
356
+ resource: str = pydantic.Field(
357
+ description="ID of the resource this tag references.",
358
+ )
359
+
360
+ description: str = pydantic.Field(
361
+ description="A short description of the tag. Interpreted as Markdown."
362
+ " This should include information about how the tagged version is"
363
+ " different from other versions."
364
+ )
365
+
366
+
367
+ class Tag(TagBase):
368
+ created: datetime = pydantic.Field(description="Tag creation time.")
369
+
370
+
371
+ class Family(Labeled, SchemaVersion, DyffModelWithID):
372
+ kind: Literal["Family"] = "Family"
373
+
374
+ resourceKind: FamilyMemberKind = pydantic.Field(
375
+ description="The kind of resource that comprises the family.",
376
+ )
377
+
378
+ tags: list[Tag] = pydantic.Field(
379
+ default_factory=list,
380
+ description="Tags mapping interpretable names to resource IDs.",
381
+ )
382
+
383
+ documentation: Documentation = pydantic.Field(
384
+ default_factory=Documentation,
385
+ description="Documentation of the resource family. The content is used"
386
+ " to populate various views in the web UI.",
387
+ )
388
+
389
+
390
+ class DyffEntity(Status, Labeled, SchemaVersion, DyffModelWithID):
298
391
  kind: Literal[
299
392
  "Analysis",
300
393
  "Audit",
@@ -373,6 +466,9 @@ class APIFunctions(str, enum.Enum):
373
466
  query = "query"
374
467
  """Query the resource collection."""
375
468
 
469
+ edit = "edit"
470
+ """Edit properties of existing resources."""
471
+
376
472
  download = "download"
377
473
  """
378
474
  .. deprecated:: 0.5.0
@@ -578,7 +674,7 @@ class DyffDataSchema(DyffSchemaBaseModel):
578
674
  " the composition of these component schemas.",
579
675
  )
580
676
  schemaVersion: SomeSchemaVersion = pydantic.Field(
581
- default=VERSION, description="The dyff schema version"
677
+ default=SCHEMA_VERSION, description="The dyff schema version"
582
678
  )
583
679
 
584
680
  def model_type(self) -> Type[DyffSchemaBaseModel]:
@@ -601,6 +697,12 @@ class DataSchema(DyffSchemaBaseModel):
601
697
  default=None, description="The schema in JSON Schema format"
602
698
  )
603
699
 
700
+ @staticmethod
701
+ def from_model(model: Type[DyffSchemaBaseModel]) -> "DataSchema":
702
+ arrowSchema = arrow.encode_schema(arrow.arrow_schema(model))
703
+ jsonSchema = model.schema()
704
+ return DataSchema(arrowSchema=arrowSchema, jsonSchema=jsonSchema)
705
+
604
706
  @staticmethod
605
707
  def make_input_schema(
606
708
  schema: Union[pyarrow.Schema, Type[DyffSchemaBaseModel], DyffDataSchema],
@@ -1738,6 +1840,7 @@ __all__ = [
1738
1840
  "DataSources",
1739
1841
  "DataView",
1740
1842
  "Digest",
1843
+ "Documentation",
1741
1844
  "DyffDataSchema",
1742
1845
  "DyffEntity",
1743
1846
  "DyffModelWithID",
@@ -1746,6 +1849,9 @@ __all__ = [
1746
1849
  "Evaluation",
1747
1850
  "EvaluationBase",
1748
1851
  "ExtractorStep",
1852
+ "Family",
1853
+ "FamilyMember",
1854
+ "FamilyMemberKind",
1749
1855
  "ForeignInferenceService",
1750
1856
  "ForeignMethod",
1751
1857
  "ForeignModel",
@@ -1807,6 +1913,8 @@ __all__ = [
1807
1913
  "SchemaAdapter",
1808
1914
  "Status",
1809
1915
  "StorageSignedURL",
1916
+ "Tag",
1917
+ "TagBase",
1810
1918
  "TaskSchema",
1811
1919
  "entity_class",
1812
1920
  "JobStatus",
@@ -22,6 +22,7 @@ from .platform import (
22
22
  AnalysisBase,
23
23
  DatasetBase,
24
24
  DataView,
25
+ Documentation,
25
26
  EvaluationBase,
26
27
  InferenceServiceBase,
27
28
  InferenceSessionBase,
@@ -30,11 +31,12 @@ from .platform import (
30
31
  ModelSpec,
31
32
  ModuleBase,
32
33
  ReportBase,
34
+ TagBase,
33
35
  )
34
- from .version import Versioned
36
+ from .version import SchemaVersion
35
37
 
36
38
 
37
- class DyffEntityCreateRequest(Versioned, DyffSchemaBaseModel):
39
+ class DyffEntityCreateRequest(SchemaVersion, DyffSchemaBaseModel):
38
40
  account: str = pydantic.Field(description="Account that owns the entity")
39
41
 
40
42
 
@@ -49,6 +51,10 @@ class DatasetCreateRequest(DyffEntityCreateRequest, DatasetBase):
49
51
  pass
50
52
 
51
53
 
54
+ class DocumentationEditRequest(Documentation):
55
+ pass
56
+
57
+
52
58
  class InferenceServiceCreateRequest(DyffEntityCreateRequest, InferenceServiceBase):
53
59
  model: Optional[str] = pydantic.Field(
54
60
  default=None, description="ID of Model backing the service, if applicable"
@@ -105,6 +111,10 @@ class ReportCreateRequest(DyffEntityCreateRequest, ReportBase):
105
111
  )
106
112
 
107
113
 
114
+ class TagCreateRequest(TagBase):
115
+ pass
116
+
117
+
108
118
  class LabelUpdateRequest(Labeled):
109
119
  pass
110
120
 
@@ -211,6 +221,7 @@ __all__ = [
211
221
  "DyffEntityQueryRequest",
212
222
  "DatasetCreateRequest",
213
223
  "DatasetQueryRequest",
224
+ "DocumentationEditRequest",
214
225
  "EvaluationCreateRequest",
215
226
  "EvaluationQueryRequest",
216
227
  "EvaluationInferenceSessionRequest",
@@ -229,4 +240,5 @@ __all__ = [
229
240
  "ReportCreateRequest",
230
241
  "ReportQueryRequest",
231
242
  "SafetyCaseQueryRequest",
243
+ "TagCreateRequest",
232
244
  ]
@@ -5,16 +5,16 @@ from typing import Literal
5
5
 
6
6
  import pydantic
7
7
 
8
- VERSION: str = "0.1"
8
+ SCHEMA_VERSION: str = "0.1"
9
9
 
10
10
 
11
- class Versioned(pydantic.BaseModel):
11
+ class SchemaVersion(pydantic.BaseModel):
12
12
  schemaVersion: Literal["0.1"] = pydantic.Field(
13
- default=VERSION, description="The schema version."
13
+ default=SCHEMA_VERSION, description="The schema version."
14
14
  )
15
15
 
16
16
 
17
17
  __all__ = [
18
- "VERSION",
19
- "Versioned",
18
+ "SCHEMA_VERSION",
19
+ "SchemaVersion",
20
20
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dyff-schema
3
- Version: 0.4.0
3
+ Version: 0.5.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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes