Ensure live provider checks reach the provider
Some checks failed
verify / verify (push) Has been cancelled

Accept Docker Compose's exact string representation of the fixed 1024-dimensional embedding contract while rejecting every widened or ambiguous value. Entry-level smoke tests now exercise the same environment shape used by the container.

Constraint: The current local Bailian credential still returns 401 for all three capabilities and is not stored in Git.
Rejected: Change the field to an unconstrained integer | would allow a runtime dimension that disagrees with vector(1024).
Confidence: high
Scope-risk: narrow
Directive: Keep the database vector dimension and provider dimension locked together through an ADR-backed migration.
Tested: make verify; 75 backend tests; 14 frontend tests; rebuilt provider-smoke image; normal Compose smoke reached all three provider endpoints.
Not-tested: Successful live provider response remains blocked by external authentication.
This commit is contained in:
2026-07-13 03:29:19 +08:00
parent 83515e5477
commit 99b7df64ea
3 changed files with 86 additions and 1 deletions

View File

@@ -71,6 +71,16 @@ class Settings(BaseSettings):
def normalize_base_url(cls, value: str) -> str:
return value.rstrip("/")
@field_validator("embedding_dimension", mode="before")
@classmethod
def parse_embedding_dimension(cls, value: object) -> int:
"""Accept Compose's string representation without widening the contract."""
if value == "1024" or (
isinstance(value, int) and not isinstance(value, bool) and value == 1024
):
return 1024
raise ValueError("EMBEDDING_DIMENSION must be exactly 1024")
@model_validator(mode="after")
def validate_rag_limits(self) -> Self:
if self.chunk_overlap_tokens >= self.chunk_target_tokens: