The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Check for single prompt in __call__ method of the BaseLLM class (#4892)
Marcus Winter2aa3754024c2
diff --git a/langchain/llms/base.py b/langchain/llms/base.pyindex 9fbf983e01..2e92c15dc9 100644--- a/langchain/llms/base.py+++ b/langchain/llms/base.py@@ -287,6 +287,12 @@ class BaseLLM(BaseLanguageModel, ABC):self, prompt: str, stop: Optional[List[str]] = None, callbacks: Callbacks = None) -> str:"""Check Cache and run the LLM on the given prompt and input."""+ if not isinstance(prompt, str):+ raise ValueError(+ "Argument `prompt` is expected to be a string. Instead found "+ f"{type(prompt)}. If you want to run the LLM on multiple prompts, use "+ "`generate` instead."+ )return (self.generate([prompt], stop=stop, callbacks=callbacks).generations[0][0]