symfonic.cli.native_hms¶
native_hms ¶
One durable, tenant-scoped CLI HMS turn through the public Agent.
The pool belongs to this invocation. A later CLI process opens the same DSN and recalls published rows from Postgres; no process-local store is involved.
NativeHmsOutcome
dataclass
¶
NativeHmsOutcome(text: str, admitted_contribution_tokens: int, recalled_records_count: int, stage_counts: dict[str, dict[str, int]] = dict(), stages: dict[str, NativeStageEvidence] = dict())
Public reply and counts taken from the stages that performed the turn.
admitted_contribution_tokens is the prompt compiler's estimate of its
admitted contribution set, not provider token usage or legacy system tokens.
recalled_records_count is retrieval's admitted record count, not a
post-turn database inventory or legacy memory metric.
NativeStageEvidence
dataclass
¶
Count-only public stage record, including an extraction refusal reason.
run_native_hms_turn
async
¶
run_native_hms_turn(*, query: str, tenant_id: str, dsn: str, domain: str, provider: Any, model: str | ModelConfig | None = None, retrieval_min_relevance: float = 0.0) -> NativeHmsOutcome
Run one HMS turn and close its Postgres pool after lifecycle flush.
A DSN is mandatory: a one-shot CLI process cannot promise recall across processes from an in-memory backend. Scope validation precedes I/O. The native relevance floor is a per-app choice over scored recall. Its neutral default awaits calibration; legacy raw-score 0.2 is not equivalent.
Source code in src/symfonic/cli/native_hms.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |