feat(rag): steering notes — tune how Brain answers, stored in Postgres and injected into every system prompt
This commit is contained in:
+34
-1
@@ -1,7 +1,10 @@
|
||||
"""Pydantic request/response schemas (API contract)."""
|
||||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
|
||||
|
||||
class HealthResponse(BaseModel):
|
||||
@@ -73,3 +76,33 @@ class DocContent(BaseModel):
|
||||
content: str
|
||||
indexed_at: str
|
||||
chunks: int
|
||||
|
||||
|
||||
class SteeringNoteIn(BaseModel):
|
||||
"""``POST /api/steering`` body: one tuning instruction (phase 15).
|
||||
|
||||
The note is trimmed *before* the length constraints run, so a
|
||||
whitespace-only body is a 422 and a 2000-char note with surrounding
|
||||
spaces still passes.
|
||||
"""
|
||||
|
||||
note: str = Field(min_length=1, max_length=2000)
|
||||
|
||||
@field_validator("note", mode="before")
|
||||
@classmethod
|
||||
def _trim_note(cls, v: object) -> object:
|
||||
return v.strip() if isinstance(v, str) else v
|
||||
|
||||
|
||||
class SteeringNote(BaseModel):
|
||||
"""One stored steering note (API shape — ISO-8601 ``created_at``)."""
|
||||
|
||||
id: uuid.UUID
|
||||
note: str
|
||||
created_at: datetime
|
||||
|
||||
|
||||
class SteeringNoteList(BaseModel):
|
||||
"""``GET /api/steering`` response: all notes, newest first."""
|
||||
|
||||
notes: list[SteeringNote]
|
||||
|
||||
Reference in New Issue
Block a user