fix(core): prevent crash in ParrotFakeChatModel when messages list is empty (#34943)

This commit is contained in:
Jackjin authored and GitHub committed 2026-01-31 16:17:39 -05:00
1 parent ccd4032789
commit 488db577e2
1 file changed
+3
@@ -386,6 +386,9 @@ class ParrotFakeChatModel(BaseChatModel):
run_manager: CallbackManagerForLLMRun | None = None,
**kwargs: Any,
) -> ChatResult:
if not messages:
msg = "messages list cannot be empty."
raise ValueError(msg)
return ChatResult(generations=[ChatGeneration(message=messages[-1])])
@property