From a5d6bc1c718e414e7f71f70d5ac2dd3366338990 Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Mon, 18 Mar 2024 18:04:26 +0100 Subject: [PATCH] Address PR comments --- .../components/embedders/nvidia/_nvcf_backend.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/integrations/nvidia/src/haystack_integrations/components/embedders/nvidia/_nvcf_backend.py b/integrations/nvidia/src/haystack_integrations/components/embedders/nvidia/_nvcf_backend.py index dbd039e65..d3e0d4a15 100644 --- a/integrations/nvidia/src/haystack_integrations/components/embedders/nvidia/_nvcf_backend.py +++ b/integrations/nvidia/src/haystack_integrations/components/embedders/nvidia/_nvcf_backend.py @@ -6,7 +6,7 @@ from .backend import EmbedderBackend -MAX_INPUT_STRING_LENGTH = 2048 +MAX_INPUTS = 50 class NvcfBackend(EmbedderBackend): @@ -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: