dyff-schema 0.38.6__py3-none-any.whl → 0.38.8__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.
dyff/schema/_version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = version = "0.38.6"
2
- __version_tuple__ = version_tuple = (0, 38, 6)
1
+ __version__ = version = "0.38.8"
2
+ __version_tuple__ = version_tuple = (0, 38, 8)
@@ -2656,6 +2656,18 @@ class ChallengeTaskContent(DyffSchemaBaseModel):
2656
2656
  )
2657
2657
 
2658
2658
 
2659
+ class ChallengeSubmissionStructure(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: ChallengeSubmissionStructure = pydantic.Field(
2687
+ default_factory=ChallengeSubmissionStructure,
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 ChallengeSubmissionBase(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 ChallengeSubmission(DyffEntity, ChallengeSubmissionBase):
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,14 +2787,29 @@ class ChallengeSubmission(DyffEntity):
2765
2787
  class PipelineEvaluationRequest(EvaluationRequestBase):
2766
2788
  kind: Literal["PipelineEvaluationRequest"] = "PipelineEvaluationRequest"
2767
2789
 
2790
+ def dependencies(self) -> list[str]:
2791
+ # This is a dirty hack that works because the types are structurally
2792
+ # equivalent as far as .dependencies() cares
2793
+ return Evaluation.dependencies(self) # type: ignore[arg-type]
2794
+
2768
2795
 
2769
2796
  class PipelineMeasurementRequest(AnalysisRequestBase):
2770
2797
  kind: Literal["PipelineMeasurementRequest"] = "PipelineMeasurementRequest"
2771
2798
 
2799
+ def dependencies(self) -> list[str]:
2800
+ # This is a dirty hack that works because the types are structurally
2801
+ # equivalent as far as .dependencies() cares
2802
+ return Measurement.dependencies(self) # type: ignore[arg-type]
2803
+
2772
2804
 
2773
2805
  class PipelineSafetyCaseRequest(AnalysisRequestBase):
2774
2806
  kind: Literal["PipelineSafetyCaseRequest"] = "PipelineSafetyCaseRequest"
2775
2807
 
2808
+ def dependencies(self) -> list[str]:
2809
+ # This is a dirty hack that works because the types are structurally
2810
+ # equivalent as far as .dependencies() cares
2811
+ return SafetyCase.dependencies(self) # type: ignore[arg-type]
2812
+
2776
2813
 
2777
2814
  PipelineNodeRequest = Union[
2778
2815
  PipelineEvaluationRequest,
@@ -2814,16 +2851,24 @@ class PipelineNode(DyffSchemaBaseModel):
2814
2851
 
2815
2852
  class PipelineParameter(DyffSchemaBaseModel):
2816
2853
  """Declares a parameter that can be passed to the pipeline to customize its
2817
- behavior."""
2854
+ behavior.
2818
2855
 
2819
- keyword: str = pydantic.Field(description="The keyword of the argument.")
2820
- destination: str = pydantic.Field(
2856
+ By default, the argument will be substituted for the placeholder value
2857
+ ``$(keyword)``, where ``keyword`` is the ``.keyword`` property of the
2858
+ parameter. In this case, the value of the argument must be a string.
2859
+
2860
+ If ``.destination`` is specified, the argument will instead overwrite
2861
+ the value at the specified JSON path.
2862
+ """
2863
+
2864
+ keyword: str = pydantic.Field(description="The keyword of the parameter.")
2865
+ destination: Optional[str] = pydantic.Field(
2821
2866
  description="The field in a pipeline node to substitute with the"
2822
2867
  " parameter value. Should be a string like 'node_name.field1.field2'."
2823
2868
  )
2824
2869
  description: Optional[str] = pydantic.Field(
2825
2870
  default=None,
2826
- description="A description of the argument.",
2871
+ description="A description of the parameter.",
2827
2872
  max_length=summary_maxlen(),
2828
2873
  )
2829
2874
 
@@ -2834,6 +2879,9 @@ class PipelineBase(DyffSchemaBaseModel):
2834
2879
  description="The nodes in the pipeline graph.",
2835
2880
  min_length=1,
2836
2881
  )
2882
+ parameters: dict[str, PipelineParameter] = pydantic.Field(
2883
+ description="Input parameters used to customize the pipeline."
2884
+ )
2837
2885
 
2838
2886
  @pydantic.field_validator("nodes", mode="after")
2839
2887
  def validate_node_names_match(cls, nodes: dict[str, PipelineNode]):
@@ -2842,6 +2890,15 @@ class PipelineBase(DyffSchemaBaseModel):
2842
2890
  raise ValueError(f"nodes[{k}]: dict key must match value.name")
2843
2891
  return nodes
2844
2892
 
2893
+ @pydantic.field_validator("parameters", mode="after")
2894
+ def validate_parameter_keywords_match(
2895
+ cls, parameters: dict[str, PipelineParameter]
2896
+ ):
2897
+ for k, v in parameters.items():
2898
+ if k != v.keyword:
2899
+ raise ValueError(f"parameters[{k}]: dict key must match value.keyword")
2900
+ return parameters
2901
+
2845
2902
 
2846
2903
  class Pipeline(DyffEntity, PipelineBase):
2847
2904
  """A set of Dyff workflows that can be executed as a group.
@@ -3144,6 +3201,7 @@ _DyffEntityTypeRevisable = Union[
3144
3201
  Audit,
3145
3202
  AuditProcedure,
3146
3203
  Challenge,
3204
+ ChallengeSubmission,
3147
3205
  DataSource,
3148
3206
  Dataset,
3149
3207
  Evaluation,
@@ -3239,6 +3297,7 @@ _ENTITY_CLASS: dict[Entities, type[DyffEntityType]] = {
3239
3297
  Entities.Report: Report,
3240
3298
  Entities.Revision: Revision,
3241
3299
  Entities.SafetyCase: SafetyCase,
3300
+ Entities.Submission: ChallengeSubmission,
3242
3301
  Entities.Team: Team,
3243
3302
  Entities.UseCase: UseCase,
3244
3303
  }
@@ -3254,6 +3313,7 @@ DyffEntityT = TypeVar(
3254
3313
  Audit,
3255
3314
  AuditProcedure,
3256
3315
  Challenge,
3316
+ ChallengeSubmission,
3257
3317
  DataSource,
3258
3318
  Dataset,
3259
3319
  Evaluation,
@@ -3304,6 +3364,7 @@ __all__ = [
3304
3364
  "ChallengeContent",
3305
3365
  "ChallengeContentPage",
3306
3366
  "ChallengeSubmission",
3367
+ "ChallengeSubmissionBase",
3307
3368
  "ChallengeTask",
3308
3369
  "ChallengeTaskBase",
3309
3370
  "ChallengeTaskContent",
@@ -27,6 +27,7 @@ from .platform import (
27
27
  AnalysisRequestBase,
28
28
  AnalysisScope,
29
29
  ChallengeContent,
30
+ ChallengeSubmissionBase,
30
31
  ChallengeTaskBase,
31
32
  ConcernBase,
32
33
  DatasetBase,
@@ -148,6 +149,12 @@ class ChallengeCreateRequest(DyffEntityCreateRequest):
148
149
  )
149
150
 
150
151
 
152
+ class ChallengeSubmissionCreateRequest(
153
+ DyffEntityCreateRequest, ChallengeSubmissionBase
154
+ ):
155
+ pass
156
+
157
+
151
158
  class ChallengeTaskCreateRequest(DyffEntityCreateRequest, ChallengeTaskBase):
152
159
  pass
153
160
 
@@ -497,6 +504,7 @@ __all__ = [
497
504
  "ChallengeContentEditRequest",
498
505
  "ChallengeCreateRequest",
499
506
  "ChallengeQueryRequest",
507
+ "ChallengeSubmissionCreateRequest",
500
508
  "ChallengeTaskCreateRequest",
501
509
  "ChallengeTaskRulesEditRequest",
502
510
  "ChallengeTeamCreateRequest",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dyff-schema
3
- Version: 0.38.6
3
+ Version: 0.38.8
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=Kj9GP_7NUacasKg6ybcdwasvyMnqhCYPGnOrKFolAWQ,80
2
+ dyff/schema/_version.py,sha256=8nvvdBGaI2RNwHTn3-quX0iQmgetuBy0_zZjRo7-BYY,80
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=U5t-Giixi52_aWpDzZVrXfLSAmar1i2BoFA0mSstWtg,111220
33
- dyff/schema/v0/r1/requests.py,sha256=9fFUTv4Zgt5Dq2ueQRGjaBU-RxacNMrDZW40RMEwsIg,18414
32
+ dyff/schema/v0/r1/platform.py,sha256=Euclx-Hj6TPNZNqHObQi9HRZyN-XEvkm5PWKTgjtVTM,113794
33
+ dyff/schema/v0/r1/requests.py,sha256=k9T-xI2DDCjvCCmEg_kZ0M6yl_ZG6uh8rocWCLZLKFA,18590
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.6.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
47
- dyff_schema-0.38.6.dist-info/licenses/NOTICE,sha256=YONACu0s_Ui6jNi-wtEsVQbTU1JIkh8wvLH6d1-Ni_w,43
48
- dyff_schema-0.38.6.dist-info/METADATA,sha256=f8TUmKB1WVBTwptV_BrVgMVovyNT8WTYX_Fyci1urEQ,3734
49
- dyff_schema-0.38.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
50
- dyff_schema-0.38.6.dist-info/top_level.txt,sha256=9e3VVdeX73t_sUJOPQPCcGtYO1JhoErhHIi3WoWGcFI,5
51
- dyff_schema-0.38.6.dist-info/RECORD,,
46
+ dyff_schema-0.38.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
47
+ dyff_schema-0.38.8.dist-info/licenses/NOTICE,sha256=YONACu0s_Ui6jNi-wtEsVQbTU1JIkh8wvLH6d1-Ni_w,43
48
+ dyff_schema-0.38.8.dist-info/METADATA,sha256=MlHZqrl42WtH4VNitu9mFfnURbpwjD5HpPTxVdnrfps,3734
49
+ dyff_schema-0.38.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
50
+ dyff_schema-0.38.8.dist-info/top_level.txt,sha256=9e3VVdeX73t_sUJOPQPCcGtYO1JhoErhHIi3WoWGcFI,5
51
+ dyff_schema-0.38.8.dist-info/RECORD,,