Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clams/appmetadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ class AppMetadata(pydantic.BaseModel):
None,
description="(optional) Version of an analyzer software, if the app is working as a wrapper for one. "
)
analyzer_versions: Optional[Dict[str, str]] = pydantic.Field(
None,
description="(optional) Map of analyzer IDs to their versions, for apps that wrap multiple models or families."
)
app_license: str = pydantic.Field(
...,
description="License information of the app."
Expand Down
29 changes: 29 additions & 0 deletions tests/test_clamsapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,35 @@ def test_est_gpu_mem_typ_validation(self):
# Should have auto-corrected
self.assertEqual(metadata.est_gpu_mem_typ, metadata.est_gpu_mem_min)

def test_analyzer_versions_default_none(self):
"""analyzer_versions field defaults to None."""
metadata = AppMetadata(
name="Test App",
description="Test",
app_license="MIT",
identifier="test-app",
url="https://example.com",
)
metadata.add_input(DocumentTypes.TextDocument)
metadata.add_output(AnnotationTypes.TimeFrame)

self.assertIsNone(metadata.analyzer_versions)

def test_analyzer_versions_with_value(self):
"""analyzer_versions can be set with a dictionary."""
test_versions = {"model_a": "1.0", "model_b": "2.1"}
metadata = AppMetadata(
name="Test App",
description="Test",
app_license="MIT",
identifier="test-app",
url="https://example.com",
analyzer_versions=test_versions,
)
metadata.add_input(DocumentTypes.TextDocument)
metadata.add_output(AnnotationTypes.TimeFrame)

self.assertEqual(metadata.analyzer_versions, test_versions)

class TestRestifier(unittest.TestCase):

Expand Down
Loading