dyff-schema 0.38.3__py3-none-any.whl → 0.38.13__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.

dyff/schema/_version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = version = "0.38.3"
2
- __version_tuple__ = version_tuple = (0, 38, 3)
1
+ __version__ = version = "0.38.13"
2
+ __version_tuple__ = version_tuple = (0, 38, 13)
@@ -2656,6 +2656,18 @@ class ChallengeTaskContent(DyffSchemaBaseModel):
2656
2656
  )
2657
2657
 
2658
2658
 
2659
+ class SubmissionStructure(DyffSchemaBaseModel):
2660
+ submissionKind: EntityKindLiteral = pydantic.Field(
2661
+ default=Entities.InferenceService.value,
2662
+ description="The kind of entity that you can submit to this task.",
2663
+ )
2664
+ pipelineKeyword: str = pydantic.Field(
2665
+ default="submission",
2666
+ description="The keyword parameter where the submitted entity ID"
2667
+ " should be passed to the assessment Pipeline.",
2668
+ )
2669
+
2670
+
2659
2671
  class ChallengeTaskBase(DyffSchemaBaseModel):
2660
2672
  """The part of the ChallengeTask spec that is not system-populated."""
2661
2673
 
@@ -2669,7 +2681,11 @@ class ChallengeTaskBase(DyffSchemaBaseModel):
2669
2681
  pattern=r"[a-z0-9-]*",
2670
2682
  )
2671
2683
  assessment: str = pydantic.Field(
2672
- description="ID of the Assessment that the task runs."
2684
+ description="ID of the Pipeline used to assess the submission."
2685
+ )
2686
+ submissionStructure: SubmissionStructure = pydantic.Field(
2687
+ default_factory=SubmissionStructure,
2688
+ description="How to run the assessment pipeline on a new submission.",
2673
2689
  )
2674
2690
  rules: ChallengeTaskRules = pydantic.Field(description="The rules for submissions.")
2675
2691
  content: ChallengeTaskContent = pydantic.Field(
@@ -2729,7 +2745,14 @@ class Challenge(DyffEntity):
2729
2745
  return None
2730
2746
 
2731
2747
 
2732
- class ChallengeSubmission(DyffEntity):
2748
+ class SubmissionBase(DyffSchemaBaseModel):
2749
+ team: str = pydantic.Field(description="The ID of the team making the submission.")
2750
+ submission: EntityIdentifier = pydantic.Field(
2751
+ description="The resource being submitted for assessment."
2752
+ )
2753
+
2754
+
2755
+ class Submission(DyffEntity, SubmissionBase):
2733
2756
  """A submission of an inference system to a challenge by a team.
2734
2757
 
2735
2758
  All of the constituent resources must already exist. Creating a Submission simply
@@ -2746,9 +2769,8 @@ class ChallengeSubmission(DyffEntity):
2746
2769
  task: str = pydantic.Field(
2747
2770
  description="The key of the task within the challenge being submitted to."
2748
2771
  )
2749
- team: str = pydantic.Field(description="The ID of the team making the submission.")
2750
- inferenceService: str = pydantic.Field(
2751
- description="The ID of the inference service being submitted."
2772
+ pipelineRun: str = pydantic.Field(
2773
+ description="The ID of the PipelineRun for this submission."
2752
2774
  )
2753
2775
 
2754
2776
  def dependencies(self) -> list[str]:
@@ -2765,16 +2787,35 @@ class ChallengeSubmission(DyffEntity):
2765
2787
  class PipelineEvaluationRequest(EvaluationRequestBase):
2766
2788
  kind: Literal["PipelineEvaluationRequest"] = "PipelineEvaluationRequest"
2767
2789
 
2790
+ def dependencies(self) -> list[str]:
2791
+ if self.inferenceSession is None:
2792
+ raise AssertionError()
2793
+ return [self.dataset, self.inferenceSession.inferenceService]
2794
+
2795
+ @pydantic.model_validator(mode="after")
2796
+ def check_session_not_reference(self):
2797
+ if self.inferenceSession is None or self.inferenceSessionReference is not None:
2798
+ raise ValueError(
2799
+ "evaluations in pipelines must set inferenceSession, not inferenceSessionReference"
2800
+ )
2801
+ return self
2802
+
2768
2803
 
2769
2804
  class PipelineMeasurementRequest(AnalysisRequestBase):
2770
2805
  kind: Literal["PipelineMeasurementRequest"] = "PipelineMeasurementRequest"
2771
2806
 
2807
+ def dependencies(self) -> list[str]:
2808
+ return [self.method] + [x.entity for x in self.inputs]
2809
+
2772
2810
 
2773
2811
  class PipelineSafetyCaseRequest(AnalysisRequestBase):
2774
2812
  kind: Literal["PipelineSafetyCaseRequest"] = "PipelineSafetyCaseRequest"
2775
2813
 
2814
+ def dependencies(self) -> list[str]:
2815
+ return [self.method] + [x.entity for x in self.inputs]
2816
+
2776
2817
 
2777
- PipelineNodeRequest: TypeAlias = Union[
2818
+ PipelineNodeRequest = Union[
2778
2819
  PipelineEvaluationRequest,
2779
2820
  PipelineMeasurementRequest,
2780
2821
  PipelineSafetyCaseRequest,
@@ -2793,8 +2834,7 @@ class PipelineNode(DyffSchemaBaseModel):
2793
2834
  description="The name of the node. Must be unique in the context of the pipeline."
2794
2835
  )
2795
2836
 
2796
- request: PipelineNodeRequest = pydantic.Field( # type: ignore[valid-type]
2797
- discriminator="kind",
2837
+ request: PipelineNodeRequest = pydantic.Field(
2798
2838
  description="The request template that will be executed when this node"
2799
2839
  ' executes. You can use the syntax "$(node_name)" in request fields'
2800
2840
  " that reference another entity to indicate that the request depends"
@@ -2803,19 +2843,37 @@ class PipelineNode(DyffSchemaBaseModel):
2803
2843
  " dependency graph structure from these placeholders.",
2804
2844
  )
2805
2845
 
2846
+ # The .kind field is dropped when we serialize nodes as part of a
2847
+ # PipelineCreateRequest because of the default exclude_unset=True
2848
+ # behavior for requests, so we add it back.
2849
+ @pydantic.field_serializer("request")
2850
+ def _serialize_request(self, request: PipelineNodeRequest, _info):
2851
+ data = request.model_dump(mode=_info.mode)
2852
+ data["kind"] = request.kind
2853
+ return data
2854
+
2806
2855
 
2807
2856
  class PipelineParameter(DyffSchemaBaseModel):
2808
2857
  """Declares a parameter that can be passed to the pipeline to customize its
2809
- behavior."""
2858
+ behavior.
2859
+
2860
+ By default, the argument will be substituted for the placeholder value
2861
+ ``$(keyword)``, where ``keyword`` is the ``.keyword`` property of the
2862
+ parameter. In this case, the value of the argument must be a string.
2810
2863
 
2811
- keyword: str = pydantic.Field(description="The keyword of the argument.")
2812
- destination: str = pydantic.Field(
2864
+ If ``.destination`` is specified, the argument will instead overwrite
2865
+ the value at the specified JSON path.
2866
+ """
2867
+
2868
+ keyword: str = pydantic.Field(description="The keyword of the parameter.")
2869
+ destination: Optional[str] = pydantic.Field(
2870
+ default=None,
2813
2871
  description="The field in a pipeline node to substitute with the"
2814
- " parameter value. Should be a string like 'node_name.field1.field2'."
2872
+ " parameter value. Should be a string like 'node_name.field1.field2'.",
2815
2873
  )
2816
2874
  description: Optional[str] = pydantic.Field(
2817
2875
  default=None,
2818
- description="A description of the argument.",
2876
+ description="A description of the parameter.",
2819
2877
  max_length=summary_maxlen(),
2820
2878
  )
2821
2879
 
@@ -2826,6 +2884,10 @@ class PipelineBase(DyffSchemaBaseModel):
2826
2884
  description="The nodes in the pipeline graph.",
2827
2885
  min_length=1,
2828
2886
  )
2887
+ parameters: dict[str, PipelineParameter] = pydantic.Field(
2888
+ default_factory=dict,
2889
+ description="Input parameters used to customize the pipeline.",
2890
+ )
2829
2891
 
2830
2892
  @pydantic.field_validator("nodes", mode="after")
2831
2893
  def validate_node_names_match(cls, nodes: dict[str, PipelineNode]):
@@ -2834,6 +2896,15 @@ class PipelineBase(DyffSchemaBaseModel):
2834
2896
  raise ValueError(f"nodes[{k}]: dict key must match value.name")
2835
2897
  return nodes
2836
2898
 
2899
+ @pydantic.field_validator("parameters", mode="after")
2900
+ def validate_parameter_keywords_match(
2901
+ cls, parameters: dict[str, PipelineParameter]
2902
+ ):
2903
+ for k, v in parameters.items():
2904
+ if k != v.keyword:
2905
+ raise ValueError(f"parameters[{k}]: dict key must match value.keyword")
2906
+ return parameters
2907
+
2837
2908
 
2838
2909
  class Pipeline(DyffEntity, PipelineBase):
2839
2910
  """A set of Dyff workflows that can be executed as a group.
@@ -3152,6 +3223,7 @@ _DyffEntityTypeRevisable = Union[
3152
3223
  PipelineRun,
3153
3224
  Report,
3154
3225
  SafetyCase,
3226
+ Submission,
3155
3227
  Team,
3156
3228
  UseCase,
3157
3229
  ]
@@ -3231,6 +3303,7 @@ _ENTITY_CLASS: dict[Entities, type[DyffEntityType]] = {
3231
3303
  Entities.Report: Report,
3232
3304
  Entities.Revision: Revision,
3233
3305
  Entities.SafetyCase: SafetyCase,
3306
+ Entities.Submission: Submission,
3234
3307
  Entities.Team: Team,
3235
3308
  Entities.UseCase: UseCase,
3236
3309
  }
@@ -3264,6 +3337,7 @@ DyffEntityT = TypeVar(
3264
3337
  Report,
3265
3338
  Revision,
3266
3339
  SafetyCase,
3340
+ Submission,
3267
3341
  Team,
3268
3342
  UseCase,
3269
3343
  )
@@ -3295,7 +3369,6 @@ __all__ = [
3295
3369
  "Challenge",
3296
3370
  "ChallengeContent",
3297
3371
  "ChallengeContentPage",
3298
- "ChallengeSubmission",
3299
3372
  "ChallengeTask",
3300
3373
  "ChallengeTaskBase",
3301
3374
  "ChallengeTaskContent",
@@ -3432,6 +3505,9 @@ __all__ = [
3432
3505
  "ScoreMetadataRefs",
3433
3506
  "Status",
3434
3507
  "StorageSignedURL",
3508
+ "Submission",
3509
+ "SubmissionBase",
3510
+ "SubmissionStructure",
3435
3511
  "TagName",
3436
3512
  "TagNameType",
3437
3513
  "TaskSchema",
@@ -45,6 +45,7 @@ from .platform import (
45
45
  PipelineBase,
46
46
  PipelineRunBase,
47
47
  ReportBase,
48
+ SubmissionBase,
48
49
  TagNameType,
49
50
  TeamBase,
50
51
  summary_maxlen,
@@ -148,6 +149,10 @@ class ChallengeCreateRequest(DyffEntityCreateRequest):
148
149
  )
149
150
 
150
151
 
152
+ class SubmissionCreateRequest(DyffEntityCreateRequest, SubmissionBase):
153
+ pass
154
+
155
+
151
156
  class ChallengeTaskCreateRequest(DyffEntityCreateRequest, ChallengeTaskBase):
152
157
  pass
153
158
 
@@ -398,6 +403,10 @@ class AuditQueryRequest(DyffEntityQueryRequest):
398
403
  name: Optional[str] = pydantic.Field(default=None)
399
404
 
400
405
 
406
+ class ChallengeQueryRequest(DyffEntityQueryRequest):
407
+ pass
408
+
409
+
401
410
  class DatasetQueryRequest(DyffEntityQueryRequest):
402
411
  name: Optional[str] = pydantic.Field(default=None)
403
412
 
@@ -492,6 +501,7 @@ __all__ = [
492
501
  "AuditQueryRequest",
493
502
  "ChallengeContentEditRequest",
494
503
  "ChallengeCreateRequest",
504
+ "ChallengeQueryRequest",
495
505
  "ChallengeTaskCreateRequest",
496
506
  "ChallengeTaskRulesEditRequest",
497
507
  "ChallengeTeamCreateRequest",
@@ -531,6 +541,7 @@ __all__ = [
531
541
  "ReportQueryRequest",
532
542
  "SafetyCaseQueryRequest",
533
543
  "ScoreQueryRequest",
544
+ "SubmissionCreateRequest",
534
545
  "TeamEditRequest",
535
546
  "TeamQueryRequest",
536
547
  "UseCaseQueryRequest",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dyff-schema
3
- Version: 0.38.3
3
+ Version: 0.38.13
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
@@ -1,5 +1,5 @@
1
1
  dyff/schema/__init__.py,sha256=w7OWDFuyGKd6xt_yllNtKzHahPgywrfU4Ue02psYaMA,2244
2
- dyff/schema/_version.py,sha256=-CCWFr62vN0w7SrCBH-IeTHMoX8ScRHffpLPQafa5pY,80
2
+ dyff/schema/_version.py,sha256=50V94fT_56OCMvK0CeEH1SwgrRmZ0di-SpcyDei7ROA,82
3
3
  dyff/schema/adapters.py,sha256=YMTHv_2VlLGFp-Kqwa6H51hjffHmk8gXjZilHysIF5Q,123
4
4
  dyff/schema/annotations.py,sha256=nE6Jk1PLqlShj8uqjE_EzZC9zYnTDW5AVtQcjysiK8M,10018
5
5
  dyff/schema/base.py,sha256=jvaNtsSZyFfsdUZTcY_U-yfLY5_GyrMxSXhON2R9XR0,119
@@ -29,8 +29,8 @@ dyff/schema/v0/r1/adapters.py,sha256=hpwCSW8lkMkUKCLe0zaMUDu-VS_caSxJvPsECEi_XRA
29
29
  dyff/schema/v0/r1/base.py,sha256=1VJXVLKldOq3aH2HdVgxXXk4DJTZEIiaTa4GzMKzziU,20228
30
30
  dyff/schema/v0/r1/commands.py,sha256=jqbEvDRLpcVGWXqlbniuSKg3UIjlrpKt6_0hiwUpPfQ,20153
31
31
  dyff/schema/v0/r1/oci.py,sha256=YjHDVBJ2IIxqijll70OK6pM-qT6pq8tvU7D3YB9vGM0,6700
32
- dyff/schema/v0/r1/platform.py,sha256=bQO3gQ6G-7Cl_FHHNLW1ozAG-ShYPOTIf-NfB6uvnps,110880
33
- dyff/schema/v0/r1/requests.py,sha256=JMpdx9WBlUpePshacG85XMmlGPBkkaK5453VaK3kH9s,18321
32
+ dyff/schema/v0/r1/platform.py,sha256=x6-JVK_gw1io-8A89zJfH_3pOu9qZxactsuhFrNNQmU,113785
33
+ dyff/schema/v0/r1/requests.py,sha256=OhkM9QpSimsGaX8TtjSHcWlHg1UYyPCiq-WW9DJ7FdQ,18548
34
34
  dyff/schema/v0/r1/responses.py,sha256=nxy7FPtfw2B_bljz5UGGuSE79HTkDQxKH56AJVmd4Qo,1287
35
35
  dyff/schema/v0/r1/test.py,sha256=X6dUyVd5svcPCI-PBMOAqEfK9jv3bRDvkQTJzwS96c0,10720
36
36
  dyff/schema/v0/r1/version.py,sha256=NONebgcv5Thsw_ymud6PacZdGjV6ndBrmLnap-obcpo,428
@@ -43,9 +43,9 @@ dyff/schema/v0/r1/dataset/text.py,sha256=MYG5seGODDryRSCy-g0Unh5dD0HCytmZ3FeElC-
43
43
  dyff/schema/v0/r1/dataset/vision.py,sha256=tJFF4dkhHX0UXTj1sPW-G22xTSI40gbYO465FuvmvAU,443
44
44
  dyff/schema/v0/r1/io/__init__.py,sha256=L5y8UhRnojerPYHumsxQJRcHCNz8Hj9NM8b47mewMNs,92
45
45
  dyff/schema/v0/r1/io/vllm.py,sha256=vWyLg-susbg0JDfv6VExBpgFdU2GHP2a14ChOdbckvs,5321
46
- dyff_schema-0.38.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
47
- dyff_schema-0.38.3.dist-info/licenses/NOTICE,sha256=YONACu0s_Ui6jNi-wtEsVQbTU1JIkh8wvLH6d1-Ni_w,43
48
- dyff_schema-0.38.3.dist-info/METADATA,sha256=LRDYIEaUA4AMUGCTGCLb1ABwrCh6rT28AU8ywiYU60o,3734
49
- dyff_schema-0.38.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
50
- dyff_schema-0.38.3.dist-info/top_level.txt,sha256=9e3VVdeX73t_sUJOPQPCcGtYO1JhoErhHIi3WoWGcFI,5
51
- dyff_schema-0.38.3.dist-info/RECORD,,
46
+ dyff_schema-0.38.13.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
47
+ dyff_schema-0.38.13.dist-info/licenses/NOTICE,sha256=YONACu0s_Ui6jNi-wtEsVQbTU1JIkh8wvLH6d1-Ni_w,43
48
+ dyff_schema-0.38.13.dist-info/METADATA,sha256=0_GHYLYCJl_ivN-40TZwmtwey-qsgf63pHQgIqBaOf0,3735
49
+ dyff_schema-0.38.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
50
+ dyff_schema-0.38.13.dist-info/top_level.txt,sha256=9e3VVdeX73t_sUJOPQPCcGtYO1JhoErhHIi3WoWGcFI,5
51
+ dyff_schema-0.38.13.dist-info/RECORD,,