Skip to content

Commit bafdb1c

Browse files
committed
added a new metadata field for multi-model/family app
1 parent 7c79f1d commit bafdb1c

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

clams/appmetadata/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ class AppMetadata(pydantic.BaseModel):
290290
None,
291291
description="(optional) Version of an analyzer software, if the app is working as a wrapper for one. "
292292
)
293+
analyzer_versions: Optional[Dict[str, str]] = pydantic.Field(
294+
None,
295+
description="(optional) Map of analyzer IDs to their versions, for apps that wrap multiple models or families."
296+
)
293297
app_license: str = pydantic.Field(
294298
...,
295299
description="License information of the app."

tests/test_clamsapp.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,35 @@ def test_est_gpu_mem_typ_validation(self):
431431
# Should have auto-corrected
432432
self.assertEqual(metadata.est_gpu_mem_typ, metadata.est_gpu_mem_min)
433433

434+
def test_analyzer_versions_default_none(self):
435+
"""analyzer_versions field defaults to None."""
436+
metadata = AppMetadata(
437+
name="Test App",
438+
description="Test",
439+
app_license="MIT",
440+
identifier="test-app",
441+
url="https://example.com",
442+
)
443+
metadata.add_input(DocumentTypes.TextDocument)
444+
metadata.add_output(AnnotationTypes.TimeFrame)
445+
446+
self.assertIsNone(metadata.analyzer_versions)
447+
448+
def test_analyzer_versions_with_value(self):
449+
"""analyzer_versions can be set with a dictionary."""
450+
test_versions = {"model_a": "1.0", "model_b": "2.1"}
451+
metadata = AppMetadata(
452+
name="Test App",
453+
description="Test",
454+
app_license="MIT",
455+
identifier="test-app",
456+
url="https://example.com",
457+
analyzer_versions=test_versions,
458+
)
459+
metadata.add_input(DocumentTypes.TextDocument)
460+
metadata.add_output(AnnotationTypes.TimeFrame)
461+
462+
self.assertEqual(metadata.analyzer_versions, test_versions)
434463

435464
class TestRestifier(unittest.TestCase):
436465

0 commit comments

Comments
 (0)