32 lines
659 B
Python
32 lines
659 B
Python
|
||
"""Data models for t‑SNE exports.
|
||
|
||
These models are used by *vecview* and any endpoint that needs to return or
|
||
validate t‑SNE projection data.
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from typing import List, Optional
|
||
from pydantic import BaseModel
|
||
|
||
|
||
class TSNEPoint(BaseModel):
|
||
"""A single point in a 3‑D t‑SNE projection."""
|
||
|
||
x: float
|
||
y: float
|
||
z: float
|
||
file_id: str
|
||
chunk: str
|
||
cluster: Optional[str] = None
|
||
hover_text: Optional[str] = None
|
||
|
||
|
||
class TSNEData(BaseModel):
|
||
"""Container returned to callers requesting a t‑SNE view."""
|
||
|
||
course_id: Optional[int] = None
|
||
total: int
|
||
points: List[TSNEPoint]
|