fahmiaziz98 commited on
Commit
b48fd08
·
1 Parent(s): e90c786

[FIX BUG]: handle string input correctly in EmbedRequest validator

Browse files
Files changed (1) hide show
  1. src/models/schemas/requests.py +3 -12
src/models/schemas/requests.py CHANGED
@@ -69,19 +69,10 @@ class EmbedRequest(BaseEmbedRequest):
69
  def validate_texts(cls, v: Union[str, List[str]]) -> List[str]:
70
  """Validate that all texts are non-empty."""
71
  if not v:
72
- raise ValueError("texts list cannot be empty")
 
 
73
 
74
- if len(v) > 100:
75
- raise ValueError(f"Batch size ({len(v)}) exceeds maximum (100)")
76
-
77
- # Validate each text
78
- validated = []
79
- for idx, text in enumerate(v):
80
- if not isinstance(text, str):
81
- raise ValueError(f"texts[{idx}] must be a string")
82
- validated.append(text)
83
-
84
- return validated
85
 
86
  class Config:
87
  json_schema_extra = {
 
69
  def validate_texts(cls, v: Union[str, List[str]]) -> List[str]:
70
  """Validate that all texts are non-empty."""
71
  if not v:
72
+ raise ValueError("Input cannot be empty")
73
+
74
+ return v
75
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
  class Config:
78
  json_schema_extra = {