filesystem.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. from typing import Dict, List, Optional
  2. from pydantic import BaseModel, Field
  3. class FileExistsResponse(BaseModel):
  4. """Response indicating whether a path exists."""
  5. exists: bool = Field(..., description="Whether the path exists")
  6. path: str = Field(..., description="The path that was checked")
  7. is_file: bool = Field(default=False, description="Whether the path is a file")
  8. is_dir: bool = Field(default=False, description="Whether the path is a directory")
  9. class GGUFParseRequest(BaseModel):
  10. """Request to parse a GGUF file on worker."""
  11. model_dict: Dict = Field(..., description="Model object serialized as dict")
  12. offload: str = Field(
  13. default="full", description="GPU offload strategy: full, partial, disable"
  14. )
  15. # Optional override parameters for special scenarios
  16. tensor_split: Optional[List[int]] = Field(
  17. default=None, description="Override tensor split"
  18. )
  19. rpc: Optional[List[str]] = Field(default=None, description="Override RPC servers")
  20. class GGUFParseResponse(BaseModel):
  21. """Response from GGUF parsing."""
  22. success: bool = Field(..., description="Whether parsing succeeded")
  23. output: Optional[str] = Field(
  24. default=None, description="JSON output from gguf-parser"
  25. )
  26. error: Optional[str] = Field(default=None, description="Error message if failed")