Skip to content

Commit

Permalink
feat: add min role and and message lengths
Browse files Browse the repository at this point in the history
  • Loading branch information
burtenshaw committed Sep 12, 2024
1 parent 11062d1 commit 899c993
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions argilla-server/src/argilla_server/api/schemas/v1/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@

from argilla_server.pydantic_v1 import BaseModel, Field

MIN_MESSAGE_LENGTH = 1
MAX_MESSAGE_LENGTH = 5000
MIN_ROLE_LENGTH = 1
MAX_ROLE_LENGTH = 20
MAX_ROLE_REGEX = r"^\S+$"


class ChatFieldValue(BaseModel):
role: str = Field(..., max_length=MAX_ROLE_LENGTH, regex=r"^\S+$")
content: str = Field(..., max_length=MAX_MESSAGE_LENGTH)
role: str = Field(..., min_role_length=MIN_ROLE_LENGTH, max_length=MAX_ROLE_LENGTH, regex=r"^\S+$")
content: str = Field(..., min_message_length=MIN_MESSAGE_LENGTH, max_length=MAX_MESSAGE_LENGTH)

0 comments on commit 899c993

Please sign in to comment.