Files
openbrain/src/models.py
Jason Woltje 5771ec5260 feat: initial alpha scaffold — FastAPI + MCP + pgvector
Implements v0.0.1 of OpenBrain:

- FastAPI REST API (capture, search, recent, stats) with Bearer auth
- MCP server (streamable HTTP at /mcp) exposing all 4 tools
- pgvector schema (vector(1024) for bge-m3)
- asyncpg connection pool with lazy init + graceful close
- Ollama embedding client with fallback (stores thought without vector if Ollama unreachable)
- Woodpecker CI pipeline (lint + kaniko build + push to Gitea registry)
- Portainer/Swarm deployment compose
- Mosaic framework files: AGENTS.md, PRD.md, TASKS.md, scratchpad

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 18:25:07 -06:00

40 lines
705 B
Python

from datetime import datetime
from typing import Any
from pydantic import BaseModel
class CaptureRequest(BaseModel):
content: str
source: str = "unknown"
metadata: dict[str, Any] = {}
class Thought(BaseModel):
id: str
content: str
source: str
metadata: dict[str, Any]
created_at: datetime
embedded: bool
class SearchRequest(BaseModel):
query: str
limit: int = 10
source: str | None = None
class SearchResult(BaseModel):
id: str
content: str
source: str
similarity: float
created_at: datetime
metadata: dict[str, Any]
class Stats(BaseModel):
total_thoughts: int
embedded_count: int
sources: list[dict[str, Any]]