From 1e60e6e15b2598e21dfb23154ab3a23f087419db Mon Sep 17 00:00:00 2001 From: 134ARG Date: Wed, 12 Apr 2023 02:02:39 +0800 Subject: [PATCH] Fix the unset argument in calling llama model (#2714) When using the llama.cpp together with agent like zero-shot-react-description, the missing branch will cause the parameter `stop` left empty, resulting in unexpected output format from the model. This patch fixes that issue. --- langchain/llms/llamacpp.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/langchain/llms/llamacpp.py b/langchain/llms/llamacpp.py index af9d9f29..0c83c763 100644 --- a/langchain/llms/llamacpp.py +++ b/langchain/llms/llamacpp.py @@ -177,6 +177,8 @@ class LlamaCpp(LLM): raise ValueError("`stop` found in both the input and default params.") elif self.stop: params["stop_sequences"] = self.stop + elif stop: + params["stop_sequences"] = stop else: params["stop_sequences"] = []