From c98b2280130ef4f1aa5a882f44100504d28714cc Mon Sep 17 00:00:00 2001 From: Hamel Husain Date: Sat, 18 Jan 2025 16:38:07 -0800 Subject: [PATCH 1/2] Make message and role length configurable --- .../src/argilla_server/api/schemas/v1/chat.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/argilla-server/src/argilla_server/api/schemas/v1/chat.py b/argilla-server/src/argilla_server/api/schemas/v1/chat.py index 11f5184ac1..c3d95941a4 100644 --- a/argilla-server/src/argilla_server/api/schemas/v1/chat.py +++ b/argilla-server/src/argilla_server/api/schemas/v1/chat.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os from pydantic import BaseModel, Field -MIN_MESSAGE_LENGTH = 1 -MAX_MESSAGE_LENGTH = 20000 - -MIN_ROLE_LENGTH = 1 -MAX_ROLE_LENGTH = 20 +MIN_MESSAGE_LENGTH = int(os.getenv("ARGILLA_MIN_MESSAGE_LENGTH", 1)) +MAX_MESSAGE_LENGTH = int(os.getenv("ARGILLA_MAX_MESSAGE_LENGTH", 20000)) +MIN_ROLE_LENGTH = int(os.getenv("ARGILLA_MIN_ROLE_LENGTH", 1)) +MAX_ROLE_LENGTH = int(os.getenv("ARGILLA_MAX_ROLE_LENGTH", 20)) class ChatFieldValue(BaseModel): role: str = Field(..., min_length=MIN_ROLE_LENGTH, max_length=MAX_ROLE_LENGTH) From 11ab37054cf11e4fa566b9f183d3f09b7d59b0c5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 19 Jan 2025 00:39:25 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- argilla-server/src/argilla_server/api/schemas/v1/chat.py | 1 + 1 file changed, 1 insertion(+) diff --git a/argilla-server/src/argilla_server/api/schemas/v1/chat.py b/argilla-server/src/argilla_server/api/schemas/v1/chat.py index c3d95941a4..9fd93318d0 100644 --- a/argilla-server/src/argilla_server/api/schemas/v1/chat.py +++ b/argilla-server/src/argilla_server/api/schemas/v1/chat.py @@ -21,6 +21,7 @@ MIN_ROLE_LENGTH = int(os.getenv("ARGILLA_MIN_ROLE_LENGTH", 1)) MAX_ROLE_LENGTH = int(os.getenv("ARGILLA_MAX_ROLE_LENGTH", 20)) + class ChatFieldValue(BaseModel): role: str = Field(..., min_length=MIN_ROLE_LENGTH, max_length=MAX_ROLE_LENGTH) content: str = Field(..., min_length=MIN_MESSAGE_LENGTH, max_length=MAX_MESSAGE_LENGTH)