mirror of
https://github.com/langchain-ai/langchain.git
synced 2026-10-17 07:09:17 +03:00
fix(core): prevent crash in ParrotFakeChatModel when messages list is empty (#34943)
This commit is contained in:
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
|
||||
|
||||
Reference in new issue
Block a user