Wire token-budget packing into the overview/rerank fallback path

This commit is contained in:
2026-08-10 12:02:31 +07:00
parent 60b4397032
commit 46469468bb
18 changed files with 768 additions and 38 deletions
+15 -4
View File
@@ -7,6 +7,20 @@ from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict
def _default_entities_path() -> Path:
"""2 parents up from apps/ai-service/config.py in a full repo checkout.
A container image that flattens apps/ai-service/ into its own root
(found live 2026-08-10: the deploy image does exactly this) doesn't have
that depth — ENTITIES_PATH env override is for it; this fallback just
keeps the class from crashing at import time when it's shallower.
"""
here = Path(__file__).resolve()
return (
here.parents[2] if len(here.parents) > 2 else here.parent
) / "ingestion/data/verified/drug_entities.json"
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
@@ -36,10 +50,7 @@ class Settings(BaseSettings):
# never uses it.
rerank_enabled: bool = False
metrics_enabled: bool = True
entities_path: Path = (
Path(__file__).resolve().parents[2]
/ "ingestion/data/verified/drug_entities.json"
)
entities_path: Path = _default_entities_path()
# F-08: a per-turn budget across RagAgent's sequential Bedrock calls
# (understand, sufficiency, generate, up to 2 entailment retries).
# Defaults sized with headroom above what a normal turn measures live