"""Stable identity and embedding profile for the public synthetic demo corpus.""" from __future__ import annotations import hashlib import json import uuid DEMO_SCOPE_NAME = "synthetic-demo" DEMO_EXPECTED_CHUNKS = 20 DEMO_FAKE_EMBEDDING_MODEL = "fake-feature-hash-v1" IDENTITY_NAMESPACE = uuid.UUID("eef85571-1f64-4a09-86d7-53fd329c3eb2") KNOWLEDGE_BASE_ID = uuid.uuid5(IDENTITY_NAMESPACE, "synthetic-demo-knowledge-base") ACCESS_SCOPE_ID = uuid.uuid5(IDENTITY_NAMESPACE, "synthetic-demo-public-scope") BAILIAN_KNOWLEDGE_BASE_ID = uuid.uuid5(IDENTITY_NAMESPACE, "synthetic-bailian-knowledge-base") BAILIAN_ACCESS_SCOPE_ID = uuid.uuid5(IDENTITY_NAMESPACE, "synthetic-bailian-public-scope") def offline_embedding_profile_hash(dimension: int) -> str: """Return the exact profile bound to vectors produced by the offline embedder.""" profile = { "api_mode": "deterministic-offline", "dimension": dimension, "endpoint_identity_hash": "local-fake", "model": DEMO_FAKE_EMBEDDING_MODEL, "normalization": "provider-default", "profile_version": 1, } serialized = json.dumps( profile, ensure_ascii=False, sort_keys=True, separators=(",", ":"), ) return hashlib.sha256(serialized.encode("utf-8")).hexdigest()