From b8e02018d98fdcda18cf4088407531429a5c3543 Mon Sep 17 00:00:00 2001 From: "S.P. Mohanty" <spmohanty91@gmail.com> Date: Mon, 18 Mar 2024 06:31:02 +0000 Subject: [PATCH] use only the first MAX_RESPONSE_CHARACTERS of response --- parsers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parsers.py b/parsers.py index 9f79af8..436c413 100644 --- a/parsers.py +++ b/parsers.py @@ -1,5 +1,7 @@ import ast +MAX_RESPONSE_CHARACTERS = 5000 + class ShoppingBenchTaskParsers: """ @@ -49,6 +51,9 @@ class ShoppingBenchTaskParsers: response, str ), f"Response must be a string, but got {type(response)}" + # Consider only the first MAX_RESPONSE_CHARACTERS + response = response[:MAX_RESPONSE_CHARACTERS] + # Attempt to retrieve the appropriate parser method for the task type. parser_method = task_parser_methods.get(self.task_type) -- GitLab