dyff-schema 0.16.1__tar.gz → 0.18.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.
- {dyff_schema-0.16.1/dyff_schema.egg-info → dyff_schema-0.18.0}/PKG-INFO +1 -1
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/platform.py +64 -24
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/requests.py +20 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0/dyff_schema.egg-info}/PKG-INFO +1 -1
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/.gitignore +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/.gitlab-ci.yml +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/.licenserc.yaml +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/.pre-commit-config.yaml +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/.prettierignore +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/.secrets.baseline +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/CODE_OF_CONDUCT.md +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/LICENSE +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/NOTICE +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/README.md +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/__init__.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/adapters.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/annotations.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/base.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/copydoc.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/dataset/__init__.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/dataset/arrow.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/dataset/binary.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/dataset/classification.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/dataset/text.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/dataset/vision.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/errors.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/ids.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/io/__init__.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/io/vllm.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/platform.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/py.typed +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/quantity.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/requests.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/test.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/__init__.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/__init__.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/adapters.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/base.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/dataset/__init__.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/dataset/arrow.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/dataset/binary.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/dataset/classification.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/dataset/text.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/dataset/vision.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/io/__init__.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/io/vllm.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/test.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/v0/r1/version.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff/schema/version.py +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff_schema.egg-info/SOURCES.txt +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff_schema.egg-info/dependency_links.txt +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff_schema.egg-info/requires.txt +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/dyff_schema.egg-info/top_level.txt +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/makefile +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/pyproject.toml +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/setup.cfg +0 -0
- {dyff_schema-0.16.1 → dyff_schema-0.18.0}/tests/test_import.py +0 -0
|
@@ -23,7 +23,6 @@ import abc
|
|
|
23
23
|
import enum
|
|
24
24
|
import urllib.parse
|
|
25
25
|
from datetime import datetime
|
|
26
|
-
from decimal import Decimal
|
|
27
26
|
from enum import Enum
|
|
28
27
|
from typing import Any, Literal, NamedTuple, Optional, Type, Union
|
|
29
28
|
|
|
@@ -160,6 +159,26 @@ def _oci_image_tag_maxlen():
|
|
|
160
159
|
return 127
|
|
161
160
|
|
|
162
161
|
|
|
162
|
+
def identifier_regex():
|
|
163
|
+
"""Python identifiers start with a letter or an underscore, and consist of letters,
|
|
164
|
+
numbers, and underscores."""
|
|
165
|
+
return r"^[a-zA-Z_][a-zA-Z0-9_]*$"
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def identifier_maxlen():
|
|
169
|
+
"""There isn't really a max length for Python identifiers, but this seems like a
|
|
170
|
+
reasonable limit for our use."""
|
|
171
|
+
return 127
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def title_maxlen() -> int:
|
|
175
|
+
return 140
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def summary_maxlen() -> int:
|
|
179
|
+
return 280
|
|
180
|
+
|
|
181
|
+
|
|
163
182
|
class Entities(str, enum.Enum):
|
|
164
183
|
"""The kinds of entities in the dyff system."""
|
|
165
184
|
|
|
@@ -1559,42 +1578,51 @@ class ScoreSpec(DyffSchemaBaseModel):
|
|
|
1559
1578
|
name: str = pydantic.Field(
|
|
1560
1579
|
description="The name of the score. Used as a key for retrieving score data."
|
|
1561
1580
|
" Must be unique within the Method context.",
|
|
1581
|
+
regex=identifier_regex(),
|
|
1582
|
+
max_length=identifier_maxlen(),
|
|
1562
1583
|
)
|
|
1563
1584
|
|
|
1564
1585
|
title: str = pydantic.Field(
|
|
1565
1586
|
description="The title text to use when displaying score information.",
|
|
1566
|
-
max_length=
|
|
1587
|
+
max_length=title_maxlen(),
|
|
1567
1588
|
)
|
|
1568
1589
|
|
|
1569
1590
|
summary: str = pydantic.Field(
|
|
1570
1591
|
description="A short text description of what the score measures.",
|
|
1571
|
-
max_length=
|
|
1592
|
+
max_length=summary_maxlen(),
|
|
1572
1593
|
)
|
|
1573
1594
|
|
|
1574
1595
|
valence: Literal["positive", "negative", "neutral"] = pydantic.Field(
|
|
1596
|
+
default="neutral",
|
|
1575
1597
|
description="A score has 'positive' valence if 'more is better',"
|
|
1576
1598
|
" 'negative' valence if 'less is better', and 'neutral' valence if"
|
|
1577
|
-
" 'better' is not meaningful for this score."
|
|
1599
|
+
" 'better' is not meaningful for this score.",
|
|
1578
1600
|
)
|
|
1579
1601
|
|
|
1580
1602
|
priority: Literal["primary", "secondary"] = pydantic.Field(
|
|
1603
|
+
default="primary",
|
|
1581
1604
|
description="The 'primary' score will be displayed in any UI widgets"
|
|
1582
|
-
" that expect a single score."
|
|
1605
|
+
" that expect a single score. There must be exactly 1 primary score.",
|
|
1583
1606
|
)
|
|
1584
1607
|
|
|
1585
|
-
minimum: Optional[
|
|
1608
|
+
minimum: Optional[float] = pydantic.Field(
|
|
1586
1609
|
default=None, description="The minimum possible value, if known."
|
|
1587
1610
|
)
|
|
1588
1611
|
|
|
1589
|
-
maximum: Optional[
|
|
1612
|
+
maximum: Optional[float] = pydantic.Field(
|
|
1590
1613
|
default=None, description="The maximum possible value, if known."
|
|
1591
1614
|
)
|
|
1592
1615
|
|
|
1593
1616
|
format: str = pydantic.Field(
|
|
1594
|
-
default="{quantity}",
|
|
1617
|
+
default="{quantity:.1f}",
|
|
1618
|
+
# Must use the 'quantity' key in the format string:
|
|
1619
|
+
# (Maybe string not ending in '}')(something like '{quantity:f}')(maybe another string)
|
|
1620
|
+
regex=r"^(.*[^{])?[{]quantity(:[^}]*)?[}]([^}].*)?$",
|
|
1595
1621
|
description="A Python 'format' string describing how to render the score"
|
|
1596
|
-
" as a string. You
|
|
1597
|
-
" string (e.g., '{quantity} {unit}')."
|
|
1622
|
+
" as a string. You *must* use the keyword 'quantity' in the format"
|
|
1623
|
+
" string, and you may use 'unit' as well (e.g., '{quantity:.2f} {unit}')."
|
|
1624
|
+
" It is *strongly recommended* that you limit the output precision"
|
|
1625
|
+
" appropriately; use ':.0f' for integer-valued scores.",
|
|
1598
1626
|
)
|
|
1599
1627
|
|
|
1600
1628
|
unit: Optional[str] = pydantic.Field(
|
|
@@ -1603,6 +1631,11 @@ class ScoreSpec(DyffSchemaBaseModel):
|
|
|
1603
1631
|
" Use standard SI abbreviations where possible for better indexing.",
|
|
1604
1632
|
)
|
|
1605
1633
|
|
|
1634
|
+
def quantity_string(self, quantity: float) -> str:
|
|
1635
|
+
"""Formats the given quantity as a string, according to the formatting
|
|
1636
|
+
information stored in this ScoreSpec."""
|
|
1637
|
+
return self.format_quantity(self.format, quantity, unit=self.unit)
|
|
1638
|
+
|
|
1606
1639
|
@pydantic.root_validator
|
|
1607
1640
|
def _validate_minimum_maximum(cls, values):
|
|
1608
1641
|
minimum = values.get("minimum")
|
|
@@ -1613,15 +1646,17 @@ class ScoreSpec(DyffSchemaBaseModel):
|
|
|
1613
1646
|
|
|
1614
1647
|
@pydantic.validator("format")
|
|
1615
1648
|
def _validate_format(cls, v):
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1649
|
+
x = cls.format_quantity(v, 3.14, unit="kg")
|
|
1650
|
+
y = cls.format_quantity(v, -2.03, unit="kg")
|
|
1651
|
+
if x == y:
|
|
1652
|
+
# Formatted results for different quantities should be different
|
|
1653
|
+
raise ValueError("format string does not mention 'quantity'")
|
|
1654
|
+
|
|
1620
1655
|
return v
|
|
1621
1656
|
|
|
1622
1657
|
@classmethod
|
|
1623
|
-
def
|
|
1624
|
-
cls, format: str, quantity:
|
|
1658
|
+
def format_quantity(
|
|
1659
|
+
cls, format: str, quantity: float, *, unit: Optional[str] = None
|
|
1625
1660
|
) -> str:
|
|
1626
1661
|
return format.format(quantity=quantity, unit=unit)
|
|
1627
1662
|
|
|
@@ -1824,19 +1859,20 @@ class ScoreData(ScoreSpec):
|
|
|
1824
1859
|
description="The Analysis that generated the current score instance."
|
|
1825
1860
|
)
|
|
1826
1861
|
|
|
1827
|
-
quantity:
|
|
1862
|
+
quantity: float = pydantic.Field(
|
|
1828
1863
|
description="The numeric quantity associated with the score."
|
|
1829
|
-
|
|
1864
|
+
)
|
|
1865
|
+
|
|
1866
|
+
quantityString: str = pydantic.Field(
|
|
1867
|
+
description="The formatted string representation of .quantity,"
|
|
1868
|
+
" after processing with the .format specification."
|
|
1830
1869
|
)
|
|
1831
1870
|
|
|
1832
1871
|
text: str = pydantic.Field(
|
|
1833
1872
|
description="A short text description of what the quantity means.",
|
|
1834
|
-
max_length=
|
|
1873
|
+
max_length=summary_maxlen(),
|
|
1835
1874
|
)
|
|
1836
1875
|
|
|
1837
|
-
def format_quantity(self) -> str:
|
|
1838
|
-
return self._format_quantity(self.format, self.quantity, unit=self.unit)
|
|
1839
|
-
|
|
1840
1876
|
|
|
1841
1877
|
class Score(ScoreData):
|
|
1842
1878
|
"""A Score is a numeric quantity describing an aspect of system performance.
|
|
@@ -2160,6 +2196,7 @@ DyffEntityType = Union[DyffEntityTypeExceptRevision, Revision]
|
|
|
2160
2196
|
|
|
2161
2197
|
|
|
2162
2198
|
__all__ = [
|
|
2199
|
+
"SYSTEM_ATTRIBUTES",
|
|
2163
2200
|
"Accelerator",
|
|
2164
2201
|
"AcceleratorGPU",
|
|
2165
2202
|
"AccessGrant",
|
|
@@ -2193,6 +2230,7 @@ __all__ = [
|
|
|
2193
2230
|
"DocumentationBase",
|
|
2194
2231
|
"DyffDataSchema",
|
|
2195
2232
|
"DyffEntity",
|
|
2233
|
+
"DyffEntityType",
|
|
2196
2234
|
"DyffModelWithID",
|
|
2197
2235
|
"DyffSchemaBaseModel",
|
|
2198
2236
|
"Entities",
|
|
@@ -2295,9 +2333,11 @@ __all__ = [
|
|
|
2295
2333
|
"ModelStatusReason",
|
|
2296
2334
|
"ReportStatus",
|
|
2297
2335
|
"ReportStatusReason",
|
|
2336
|
+
"identifier_regex",
|
|
2337
|
+
"identifier_maxlen",
|
|
2298
2338
|
"is_status_terminal",
|
|
2299
2339
|
"is_status_failure",
|
|
2300
2340
|
"is_status_success",
|
|
2301
|
-
"
|
|
2302
|
-
"
|
|
2341
|
+
"summary_maxlen",
|
|
2342
|
+
"title_maxlen",
|
|
2303
2343
|
]
|
|
@@ -290,6 +290,25 @@ class SafetyCaseQueryRequest(_AnalysisProductQueryRequest):
|
|
|
290
290
|
pass
|
|
291
291
|
|
|
292
292
|
|
|
293
|
+
class ScoreQueryRequest(DyffRequestDefaultValidators):
|
|
294
|
+
query: Optional[str] = pydantic.Field(
|
|
295
|
+
default=None,
|
|
296
|
+
description="A JSON structure describing a query, encoded as a string."
|
|
297
|
+
" Valid keys are the same as the valid query keys for the corresponding"
|
|
298
|
+
" endpoint. Values can be scalars or lists. Lists are treated as"
|
|
299
|
+
" disjunctive queries (i.e., 'value $in list').",
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
id: Optional[str] = pydantic.Field(default=None)
|
|
303
|
+
name: Optional[str] = pydantic.Field(default=None)
|
|
304
|
+
method: Optional[str] = pydantic.Field(default=None)
|
|
305
|
+
methodName: Optional[str] = pydantic.Field(default=None)
|
|
306
|
+
dataset: Optional[str] = pydantic.Field(default=None)
|
|
307
|
+
evaluation: Optional[str] = pydantic.Field(default=None)
|
|
308
|
+
inferenceService: Optional[str] = pydantic.Field(default=None)
|
|
309
|
+
model: Optional[str] = pydantic.Field(default=None)
|
|
310
|
+
|
|
311
|
+
|
|
293
312
|
__all__ = [
|
|
294
313
|
"AnalysisCreateRequest",
|
|
295
314
|
"AuditQueryRequest",
|
|
@@ -323,4 +342,5 @@ __all__ = [
|
|
|
323
342
|
"ReportCreateRequest",
|
|
324
343
|
"ReportQueryRequest",
|
|
325
344
|
"SafetyCaseQueryRequest",
|
|
345
|
+
"ScoreQueryRequest",
|
|
326
346
|
]
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|