Skip to content

Commit

Permalink
simplify and delete _check_one_item function and use assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
vkehfdl1 committed Jan 4, 2025
1 parent d75a313 commit b135dd9
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions autorag/embedding/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ def load(name: str = ""):

@staticmethod
def load_from_dict(option: List[dict]):
def _check_one_item(target: List):
if len(target) != 1:
raise ValueError("Only one embedding model is supported")

def _check_keys(target: dict):
if "type" not in target or "model_name" not in target:
raise ValueError("Both 'type' and 'model_name' must be provided")
Expand All @@ -97,7 +93,7 @@ def _get_huggingface_class():
return None
return getattr(module, "HuggingFaceEmbedding", None)

_check_one_item(option)
assert len(option) != 1, "Only one embedding model is supported"
_check_keys(option[0])

model_options = option[0]
Expand Down

0 comments on commit b135dd9

Please sign in to comment.