dyff-schema 0.3.9__tar.gz → 0.5.0__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.

Potentially problematic release.


This version of dyff-schema might be problematic. Click here for more details.

Files changed (55) hide show
  1. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/.gitlab-ci.yml +1 -1
  2. {dyff_schema-0.3.9/dyff_schema.egg-info → dyff_schema-0.5.0}/PKG-INFO +1 -1
  3. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/platform.py +148 -27
  4. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/requests.py +8 -2
  5. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/version.py +5 -5
  6. {dyff_schema-0.3.9 → dyff_schema-0.5.0/dyff_schema.egg-info}/PKG-INFO +1 -1
  7. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/.gitignore +0 -0
  8. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/.licenserc.yaml +0 -0
  9. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/.pre-commit-config.yaml +0 -0
  10. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/.prettierignore +0 -0
  11. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/.secrets.baseline +0 -0
  12. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/CODE_OF_CONDUCT.md +0 -0
  13. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/LICENSE +0 -0
  14. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/NOTICE +0 -0
  15. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/README.md +0 -0
  16. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/__init__.py +0 -0
  17. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/adapters.py +0 -0
  18. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/base.py +0 -0
  19. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/copydoc.py +0 -0
  20. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/dataset/__init__.py +0 -0
  21. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/dataset/arrow.py +0 -0
  22. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/dataset/binary.py +0 -0
  23. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/dataset/classification.py +0 -0
  24. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/dataset/text.py +0 -0
  25. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/dataset/vision.py +0 -0
  26. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/ids.py +0 -0
  27. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/io/__init__.py +0 -0
  28. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/io/vllm.py +0 -0
  29. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/platform.py +0 -0
  30. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/py.typed +0 -0
  31. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/quantity.py +0 -0
  32. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/requests.py +0 -0
  33. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/test.py +0 -0
  34. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/__init__.py +0 -0
  35. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/__init__.py +0 -0
  36. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/adapters.py +0 -0
  37. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/base.py +0 -0
  38. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/dataset/__init__.py +0 -0
  39. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/dataset/arrow.py +0 -0
  40. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/dataset/binary.py +0 -0
  41. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/dataset/classification.py +0 -0
  42. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/dataset/text.py +0 -0
  43. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/dataset/vision.py +0 -0
  44. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/io/__init__.py +0 -0
  45. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/io/vllm.py +0 -0
  46. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/v0/r1/test.py +0 -0
  47. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff/schema/version.py +0 -0
  48. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff_schema.egg-info/SOURCES.txt +0 -0
  49. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff_schema.egg-info/dependency_links.txt +0 -0
  50. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff_schema.egg-info/requires.txt +0 -0
  51. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/dyff_schema.egg-info/top_level.txt +0 -0
  52. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/makefile +0 -0
  53. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/pyproject.toml +0 -0
  54. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/setup.cfg +0 -0
  55. {dyff_schema-0.3.9 → dyff_schema-0.5.0}/tests/test_import.py +0 -0
@@ -12,7 +12,7 @@ include:
12
12
  file:
13
13
  - gitlab-release.yml
14
14
  - project: buildgarden/pipelines/detect-secrets
15
- ref: 0.1.0
15
+ ref: 0.2.1
16
16
  file:
17
17
  - detect-secrets.yml
18
18
  - project: buildgarden/pipelines/prettier
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dyff-schema
3
- Version: 0.3.9
3
+ Version: 0.5.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
@@ -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
 
@@ -139,15 +139,6 @@ def _k8s_label_value_maxlen():
139
139
  return _k8s_label_maxlen()
140
140
 
141
141
 
142
- class StorageSignedURL(DyffSchemaBaseModel):
143
- url: str = pydantic.Field(description="The signed URL")
144
- method: str = pydantic.Field(description="The HTTP method applicable to the URL")
145
- headers: dict[str, str] = pydantic.Field(
146
- default_factory=dict,
147
- description="Mandatory headers that must be passed with the request",
148
- )
149
-
150
-
151
142
  class Entities(str, enum.Enum):
152
143
  """The kinds of entities in the dyff system."""
153
144
 
@@ -158,6 +149,7 @@ class Entities(str, enum.Enum):
158
149
  DataSource = "DataSource"
159
150
  Dataset = "Dataset"
160
151
  Evaluation = "Evaluation"
152
+ Family = "Family"
161
153
  InferenceService = "InferenceService"
162
154
  InferenceSession = "InferenceSession"
163
155
  Measurement = "Measurement"
@@ -166,6 +158,7 @@ class Entities(str, enum.Enum):
166
158
  Module = "Module"
167
159
  Report = "Report"
168
160
  SafetyCase = "SafetyCase"
161
+ Tag = "Tag"
169
162
 
170
163
 
171
164
  class Resources(str, enum.Enum):
@@ -177,6 +170,7 @@ class Resources(str, enum.Enum):
177
170
  Dataset = "datasets"
178
171
  DataSource = "datasources"
179
172
  Evaluation = "evaluations"
173
+ Family = "families"
180
174
  InferenceService = "inferenceservices"
181
175
  InferenceSession = "inferencesessions"
182
176
  Measurement = "measurements"
@@ -185,6 +179,7 @@ class Resources(str, enum.Enum):
185
179
  Module = "modules"
186
180
  Report = "reports"
187
181
  SafetyCase = "safetycases"
182
+ Tag = "tags"
188
183
 
189
184
  Task = "tasks"
190
185
  """
@@ -303,7 +298,96 @@ class Status(DyffSchemaBaseModel):
303
298
  )
304
299
 
305
300
 
306
- 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):
307
391
  kind: Literal[
308
392
  "Analysis",
309
393
  "Audit",
@@ -382,6 +466,9 @@ class APIFunctions(str, enum.Enum):
382
466
  query = "query"
383
467
  """Query the resource collection."""
384
468
 
469
+ edit = "edit"
470
+ """Edit properties of existing resources."""
471
+
385
472
  download = "download"
386
473
  """
387
474
  .. deprecated:: 0.5.0
@@ -471,6 +558,43 @@ class APIKey(DyffSchemaBaseModel):
471
558
  )
472
559
 
473
560
 
561
+ # ----------------------------------------------------------------------------
562
+
563
+
564
+ class Digest(DyffSchemaBaseModel):
565
+ md5: Optional[str] = pydantic.Field(
566
+ default=None, description="md5 digest of artifact data"
567
+ )
568
+
569
+
570
+ class Artifact(DyffSchemaBaseModel):
571
+ # TODO: In v1, rename this to 'contentType' or something and commit to making it the MIME type
572
+ kind: Optional[str] = pydantic.Field(
573
+ default=None, description="The kind of artifact"
574
+ )
575
+ path: str = pydantic.Field(
576
+ description="The relative path of the artifact within the tree"
577
+ )
578
+ digest: Digest = pydantic.Field(
579
+ default_factory=Digest,
580
+ description="One or more message digests (hashes) of the artifact data",
581
+ )
582
+
583
+
584
+ class StorageSignedURL(DyffSchemaBaseModel):
585
+ url: str = pydantic.Field(description="The signed URL")
586
+ method: str = pydantic.Field(description="The HTTP method applicable to the URL")
587
+ headers: dict[str, str] = pydantic.Field(
588
+ default_factory=dict,
589
+ description="Mandatory headers that must be passed with the request",
590
+ )
591
+
592
+
593
+ class ArtifactURL(DyffSchemaBaseModel):
594
+ artifact: Artifact
595
+ signedURL: StorageSignedURL
596
+
597
+
474
598
  class AuditRequirement(DyffSchemaBaseModel):
475
599
  """An evaluation report that must exist in order to apply an AuditProcedure."""
476
600
 
@@ -543,21 +667,6 @@ class ExtractorStep(DyffSchemaBaseModel):
543
667
  type: Optional[str] = None
544
668
 
545
669
 
546
- class Digest(DyffSchemaBaseModel):
547
- md5: Optional[str] = pydantic.Field(None)
548
-
549
-
550
- class Artifact(DyffSchemaBaseModel):
551
- # TODO: Enumerate the available kinds
552
- kind: str = pydantic.Field(description="The kind of artifact")
553
- path: str = pydantic.Field(
554
- description="The relative path of the artifact within the dataset"
555
- )
556
- digest: Digest = pydantic.Field(
557
- description="One or more message digests (hashes) of the artifact data"
558
- )
559
-
560
-
561
670
  class DyffDataSchema(DyffSchemaBaseModel):
562
671
  components: list[str] = pydantic.Field(
563
672
  min_items=1,
@@ -565,7 +674,7 @@ class DyffDataSchema(DyffSchemaBaseModel):
565
674
  " the composition of these component schemas.",
566
675
  )
567
676
  schemaVersion: SomeSchemaVersion = pydantic.Field(
568
- default=VERSION, description="The dyff schema version"
677
+ default=SCHEMA_VERSION, description="The dyff schema version"
569
678
  )
570
679
 
571
680
  def model_type(self) -> Type[DyffSchemaBaseModel]:
@@ -588,6 +697,12 @@ class DataSchema(DyffSchemaBaseModel):
588
697
  default=None, description="The schema in JSON Schema format"
589
698
  )
590
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
+
591
706
  @staticmethod
592
707
  def make_input_schema(
593
708
  schema: Union[pyarrow.Schema, Type[DyffSchemaBaseModel], DyffDataSchema],
@@ -1713,6 +1828,7 @@ __all__ = [
1713
1828
  "APIKey",
1714
1829
  "ArchiveFormat",
1715
1830
  "Artifact",
1831
+ "ArtifactURL",
1716
1832
  "Audit",
1717
1833
  "AuditProcedure",
1718
1834
  "AuditRequirement",
@@ -1732,6 +1848,9 @@ __all__ = [
1732
1848
  "Evaluation",
1733
1849
  "EvaluationBase",
1734
1850
  "ExtractorStep",
1851
+ "Family",
1852
+ "FamilyMember",
1853
+ "FamilyMemberKind",
1735
1854
  "ForeignInferenceService",
1736
1855
  "ForeignMethod",
1737
1856
  "ForeignModel",
@@ -1793,6 +1912,8 @@ __all__ = [
1793
1912
  "SchemaAdapter",
1794
1913
  "Status",
1795
1914
  "StorageSignedURL",
1915
+ "Tag",
1916
+ "TagBase",
1796
1917
  "TaskSchema",
1797
1918
  "entity_class",
1798
1919
  "JobStatus",
@@ -30,11 +30,12 @@ from .platform import (
30
30
  ModelSpec,
31
31
  ModuleBase,
32
32
  ReportBase,
33
+ TagBase,
33
34
  )
34
- from .version import Versioned
35
+ from .version import SchemaVersion
35
36
 
36
37
 
37
- class DyffEntityCreateRequest(Versioned, DyffSchemaBaseModel):
38
+ class DyffEntityCreateRequest(SchemaVersion, DyffSchemaBaseModel):
38
39
  account: str = pydantic.Field(description="Account that owns the entity")
39
40
 
40
41
 
@@ -105,6 +106,10 @@ class ReportCreateRequest(DyffEntityCreateRequest, ReportBase):
105
106
  )
106
107
 
107
108
 
109
+ class TagCreateRequest(TagBase):
110
+ pass
111
+
112
+
108
113
  class LabelUpdateRequest(Labeled):
109
114
  pass
110
115
 
@@ -229,4 +234,5 @@ __all__ = [
229
234
  "ReportCreateRequest",
230
235
  "ReportQueryRequest",
231
236
  "SafetyCaseQueryRequest",
237
+ "TagCreateRequest",
232
238
  ]
@@ -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.3.9
3
+ Version: 0.5.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
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