mirror of
https://github.com/hwchase17/langchain.git
synced 2026-07-15 15:40:34 +00:00
fix(core): prevent crash in ParrotFakeChatModel when messages list is empty (#34943)
This commit is contained in:
@@ -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