Skip to content

Commit 8902f36

Browse files
committed
🐛 fix: only parse RAG_DISTANCE_THRESHOLD under pgvector
Same class of bug codex caught on #287's EMBEDDINGS_DIMENSIONS: the float() cast ran unconditionally at import, so a stale or templated non-numeric value would prevent startup for atlas-mongo deployments where the setting is already documented as ignored. Gate the parse on VECTOR_DB_TYPE=pgvector so Atlas boots cleanly regardless of the env var value.
1 parent b055db6 commit 8902f36

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

‎app/config.py‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,15 @@ async def dispatch(self, request, call_next):
222222
env_value = get_env_variable("RAG_CHECK_EMBEDDING_CTX_LENGTH", "True").lower()
223223
RAG_CHECK_EMBEDDING_CTX_LENGTH = True if env_value == "true" else False
224224

225-
_distance_threshold_raw = get_env_variable("RAG_DISTANCE_THRESHOLD", None)
226-
RAG_DISTANCE_THRESHOLD = (
227-
float(_distance_threshold_raw)
228-
if _distance_threshold_raw not in (None, "")
229-
else None
230-
)
225+
# Only parse RAG_DISTANCE_THRESHOLD when it will actually be applied (pgvector).
226+
# Under atlas-mongo the setting is documented as ignored, so parsing it
227+
# unconditionally would turn a stale/non-numeric value into a hard boot failure
228+
# for an unrelated backend.
229+
RAG_DISTANCE_THRESHOLD = None
230+
if VECTOR_DB_TYPE == VectorDBType.PGVECTOR:
231+
_distance_threshold_raw = get_env_variable("RAG_DISTANCE_THRESHOLD", None)
232+
if _distance_threshold_raw not in (None, ""):
233+
RAG_DISTANCE_THRESHOLD = float(_distance_threshold_raw)
231234

232235
## Embeddings
233236

0 commit comments

Comments
 (0)