From ce90b25313f45d6004778127f8f06a00c215c001 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Fri, 13 Dec 2024 15:21:14 -0500 Subject: [PATCH] core[patch]: Update error message in indexing code for unreachable code assertion (#28712) Minor update for error message that should never be triggered --- libs/core/langchain_core/indexing/api.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/core/langchain_core/indexing/api.py b/libs/core/langchain_core/indexing/api.py index 75efe1f5659..b5528442fd3 100644 --- a/libs/core/langchain_core/indexing/api.py +++ b/libs/core/langchain_core/indexing/api.py @@ -410,7 +410,10 @@ def index( # here due to a check that's happening above, so we check again. for source_id in source_ids: if source_id is None: - msg = "Source ids cannot be None here." + msg = ( + "source_id cannot be None at this point. " + "Reached unreachable code." + ) raise AssertionError(msg) _source_ids = cast(Sequence[str], source_ids) @@ -670,7 +673,10 @@ async def aindex( # here due to a check that's happening above, so we check again. for source_id in source_ids: if source_id is None: - msg = "Source ids cannot be None here." + msg = ( + "source_id cannot be None at this point. " + "Reached unreachable code." + ) raise AssertionError(msg) _source_ids = cast(Sequence[str], source_ids)