Skip to content

The agent engineering platform.

Replace stop clause with shorter, pythonic alternative (#7159)

Efkan S. Goktepebaf48d358348
diff --git a/langchain/llms/huggingface_pipeline.py b/langchain/llms/huggingface_pipeline.py
index f10f93354f..92da6f5fba 100644
--- a/langchain/llms/huggingface_pipeline.py
+++ b/langchain/llms/huggingface_pipeline.py
@@ -179,7 +179,7 @@ class HuggingFacePipeline(LLM):
f"Got invalid task {self.pipeline.task}, "
f"currently only {VALID_TASKS} are supported"
)
- if stop is not None:
+ if stop:
# This is a bit hacky, but I can't figure out a better way to enforce
# stop tokens when making calls to huggingface_hub.
text = enforce_stop_tokens(text, stop)