ai / backend /database /schemas.py
3v324v23's picture
agent
b4291bc
Raw
History Blame Contribute Delete
760 Bytes
from pydantic import BaseModel, Field
class Chunk(BaseModel):
id: str
repo_id: str
path: str
language: str
symbol: str = "file"
kind: str = "text"
start_line: int = 1
end_line: int = 1
content: str
class Source(BaseModel):
path: str
start_line: int
end_line: int
symbol: str
kind: str
score: float = 0.0
class QueryRequest(BaseModel):
question: str = Field(min_length=2)
top_k: int = 8
class QueryResponse(BaseModel):
answer: str
sources: list[Source]
retrieved_chunks: list[Chunk] = []
class RepoSummary(BaseModel):
repo_id: str
name: str
files_indexed: int
chunks_indexed: int
languages: dict[str, int]
architecture: dict[str, list[str] | str]