The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Fix IndexError when input_list is Empty in prep_prompts (#5769)
Sam Groenjes2184e3a4005f
diff --git a/libs/langchain/langchain/chains/llm.py b/libs/langchain/langchain/chains/llm.pyindex b1bbfae78a..18029309b6 100644--- a/libs/langchain/langchain/chains/llm.py+++ b/libs/langchain/langchain/chains/llm.py@@ -127,6 +127,8 @@ class LLMChain(Chain):) -> Tuple[List[PromptValue], Optional[List[str]]]:"""Prepare prompts from inputs."""stop = None+ if len(input_list) == 0:+ return [], stopif "stop" in input_list[0]:stop = input_list[0]["stop"]prompts = []@@ -151,6 +153,8 @@ class LLMChain(Chain):) -> Tuple[List[PromptValue], Optional[List[str]]]:"""Prepare prompts from inputs."""stop = None+ if len(input_list) == 0:+ return [], stopif "stop" in input_list[0]:stop = input_list[0]["stop"]prompts = []