feat(rag): steering notes — tune how Brain answers, stored in Postgres and injected into every system prompt
This commit is contained in:
+19
-2
@@ -6,8 +6,10 @@ Data model — see ``.agent/PLAN.md`` §Data Model:
|
||||
* ``chunks`` — retrieval units; each chunk points at its parent document
|
||||
via ``document_id``. This is how an embedding maps back to
|
||||
a document path (the "feed the whole document" requirement).
|
||||
* ``query_log`` — observability: every question, its retrieval score, the
|
||||
deflection decision, and latency.
|
||||
* ``query_log`` — observability: every question, its retrieval score,
|
||||
the deflection decision, and latency.
|
||||
* ``steering_notes`` — owner tuning notes injected into the system prompt
|
||||
of every chat turn (phase 15, ``<tuning>`` section).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -82,3 +84,18 @@ class QueryLog(Base):
|
||||
sources: Mapped[str] = mapped_column(Text, default="") # comma-joined source paths
|
||||
latency_ms: Mapped[int] = mapped_column(Integer, default=0)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
|
||||
class SteeringNote(Base):
|
||||
"""One owner tuning instruction (phase 15).
|
||||
|
||||
Notes are read into the system prompt of **every** chat turn as the
|
||||
``<tuning>`` section (oldest first, char-budgeted — see
|
||||
:func:`app.rag.prompts.build_steering_section`).
|
||||
"""
|
||||
|
||||
__tablename__ = "steering_notes"
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
note: Mapped[str] = mapped_column(Text) # trimmed, 1–2000 chars (API-enforced)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
Reference in New Issue
Block a user