rohannsinghal commited on
Commit
9d7e0bb
·
1 Parent(s): 48ed906

few final changes

Browse files
Files changed (1) hide show
  1. app/main_api.py +10 -0
app/main_api.py CHANGED
@@ -985,10 +985,20 @@ doc_processor = UniversalDocumentProcessor()
985
  kaggle_client = LazyKaggleModelClient()
986
 
987
  # --- API MODELS ---
 
 
 
 
988
  class SubmissionRequest(BaseModel):
989
  documents: List[str]
990
  questions: List[str]
991
 
 
 
 
 
 
 
992
  class SubmissionResponse(BaseModel):
993
  answers: List[str]
994
 
 
985
  kaggle_client = LazyKaggleModelClient()
986
 
987
  # --- API MODELS ---
988
+ # In main_api.py
989
+ from pydantic import BaseModel, validator
990
+ from typing import List
991
+
992
  class SubmissionRequest(BaseModel):
993
  documents: List[str]
994
  questions: List[str]
995
 
996
+ @validator('documents', pre=True)
997
+ def allow_single_string(cls, v):
998
+ if isinstance(v, str):
999
+ return [v] # Automatically convert string to a list
1000
+ return v
1001
+
1002
  class SubmissionResponse(BaseModel):
1003
  answers: List[str]
1004