From b6d5c4f71ffeca62713a8c8c12653df16ab92028 Mon Sep 17 00:00:00 2001 From: James Briggs <35938317+jamescalam@users.noreply.github.com> Date: Wed, 27 Dec 2023 19:31:47 +0100 Subject: [PATCH] fix for Encoder class --- semantic_router/schema.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/semantic_router/schema.py b/semantic_router/schema.py index 63233322..be486888 100644 --- a/semantic_router/schema.py +++ b/semantic_router/schema.py @@ -23,12 +23,12 @@ class RouteChoice(BaseModel): @dataclass class Encoder: - type: str + type: EncoderType name: str | None model: BaseEncoder def __init__(self, type: str, name: str | None): - self.type = type + self.type = EncoderType(type) self.name = name if self.type == EncoderType.HUGGINGFACE: raise NotImplementedError @@ -37,7 +37,7 @@ class Encoder: elif self.type == EncoderType.COHERE: self.model = CohereEncoder(name) else: - raise NotImplementedError + raise ValueError def __call__(self, texts: list[str]) -> list[list[float]]: return self.model(texts) -- GitLab