Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
silvanocerza committed Mar 18, 2024
1 parent 5326432 commit a5d6bc1
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from .backend import EmbedderBackend

MAX_INPUT_STRING_LENGTH = 2048
MAX_INPUTS = 50


class NvcfBackend(EmbedderBackend):
Expand Down Expand Up @@ -50,7 +50,11 @@ class EmbeddingsRequest:
encoding_format: Literal["float", "base64"] = "float"

def __post_init__(self):
if not isinstance(self.input, list):
if isinstance(self.input, list):
if len(self.input) > MAX_INPUTS:
msg = f"The number of inputs should not exceed {MAX_INPUTS}"
raise ValueError(msg)
else:
self.input = [self.input]

if len(self.input) == 0:
Expand Down

0 comments on commit a5d6bc1

Please sign in to comment.