Skip to content

Commit

Permalink
Update to throw IndexError if model name not registered
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkchen committed Mar 22, 2024
1 parent fc9e3ae commit fd4c2e7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/src/aiconfig/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ def get_model_parser(model_id: str) -> ModelParser:
Returns:
ModelParser: The retrieved model parser
"""
if model_id not in ModelParserRegistry.parser_ids():
raise IndexError(
f"Model parser '{model_id}' not found in registry, available model parsers are:\n {ModelParserRegistry.parser_ids()}"
)
return ModelParserRegistry._parsers[model_id]

@staticmethod
Expand Down

0 comments on commit fd4c2e7

Please sign in to comment.