Add the scoped PostgreSQL/pgvector schema, independent ingestion settings and ports, embedding profile checks, and trusted administrator bootstrap. Include repository contracts and guidance, organized provider-free and PostgreSQL tests, deployment setup, and byte-preserving migration attributes. Validation: 163 tests passed; all 48 PostgreSQL cases passed with pgvector Python 0.5.0 and 0.3.6. No production schema or historical metadata was changed.
31 lines
932 B
Python
31 lines
932 B
Python
"""Ports only; concrete intake, embedding and publication arrive in later phases."""
|
|
from typing import Mapping, Protocol, Sequence
|
|
from uuid import UUID
|
|
|
|
from .types import EmbeddingProfile
|
|
|
|
|
|
class FileStore(Protocol):
|
|
def put(self, content: bytes) -> str:
|
|
"""Create a new immutable original under a generated key; never overwrite."""
|
|
...
|
|
|
|
def read(self, storage_key: str) -> bytes: ...
|
|
|
|
|
|
class EmbeddingProvider(Protocol):
|
|
@property
|
|
def profile(self) -> EmbeddingProfile: ...
|
|
|
|
def embed(self, texts: Sequence[str]) -> Sequence[Sequence[float]]: ...
|
|
|
|
|
|
class DocumentRepository(Protocol):
|
|
def get_document(
|
|
self, organization_id: UUID, document_id: UUID
|
|
) -> Mapping[str, object] | None: ...
|
|
|
|
def get_enabled_administrator(self, user_id: UUID) -> Mapping[str, object] | None:
|
|
"""Resolve scope from a trusted operator's persisted administrator identity."""
|
|
...
|