Soumik-404 commited on
Commit
d764ccd
·
1 Parent(s): d7eda54

cpu version

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. app/models/schemas.py +10 -0
Dockerfile CHANGED
@@ -17,7 +17,7 @@ WORKDIR /app
17
 
18
  COPY requirements.txt .
19
  RUN pip install --no-cache-dir --upgrade pip && \
20
- pip install --no-cache-dir -r requirements.txt && \
21
  python -m spacy download en_core_web_sm
22
 
23
  RUN pip install --no-cache-dir "youtube-transcript-api>=1.2.4"
 
17
 
18
  COPY requirements.txt .
19
  RUN pip install --no-cache-dir --upgrade pip && \
20
+ pip install --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu && \
21
  python -m spacy download en_core_web_sm
22
 
23
  RUN pip install --no-cache-dir "youtube-transcript-api>=1.2.4"
app/models/schemas.py CHANGED
@@ -5,6 +5,7 @@ from typing import Any, Dict, List, Literal, Optional
5
  from pydantic import BaseModel, Field, field_validator, model_validator
6
 
7
 
 
8
  class ConversionMetadata(BaseModel):
9
  source: str
10
  char_count: int
@@ -236,6 +237,15 @@ class EmbeddingRequest(BaseModel):
236
  content: List[str] = Field(..., min_length=1, max_length=10, description="Array of text strings to embed (max 10)")
237
  dimension: int = Field(default=384, ge=384, le=1024, description="Target embedding dimension (384, 768, or 1024)")
238
 
 
 
 
 
 
 
 
 
 
239
 
240
  class EmbeddingResponse(BaseModel):
241
  success: bool
 
5
  from pydantic import BaseModel, Field, field_validator, model_validator
6
 
7
 
8
+
9
  class ConversionMetadata(BaseModel):
10
  source: str
11
  char_count: int
 
237
  content: List[str] = Field(..., min_length=1, max_length=10, description="Array of text strings to embed (max 10)")
238
  dimension: int = Field(default=384, ge=384, le=1024, description="Target embedding dimension (384, 768, or 1024)")
239
 
240
+ @field_validator("content")
241
+ @classmethod
242
+ def validate_content_length(cls, v: List[str]) -> List[str]:
243
+ if len(v) > 10:
244
+ raise ValueError("Maximum 10 text items allowed per request.")
245
+ if len(v) < 1:
246
+ raise ValueError("At least 1 text item is required.")
247
+ return v
248
+
249
 
250
  class EmbeddingResponse(BaseModel):
251
  success: bool