From 1f135d09ec0cc552bca80432f440acd8d7fc5e67 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 16 Jun 2023 15:41:14 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(custom.py):=20handle=20case?= =?UTF-8?q?=20where=20vectorstoreroutertoolkit=20is=20already=20a=20list?= =?UTF-8?q?=20The=20constructor=20of=20VectorStoreRouterAgent=20expects=20?= =?UTF-8?q?a=20non-list=20object=20for=20vectorstoreroutertoolkit.=20Howev?= =?UTF-8?q?er,=20in=20some=20cases,=20vectorstoreroutertoolkit=20is=20alre?= =?UTF-8?q?ady=20a=20list.=20This=20commit=20fixes=20the=20issue=20by=20ch?= =?UTF-8?q?ecking=20if=20vectorstoreroutertoolkit=20is=20a=20list=20and=20?= =?UTF-8?q?using=20it=20directly=20if=20it=20is.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/agents/custom.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/interface/agents/custom.py b/src/backend/langflow/interface/agents/custom.py index 2b0cd98e0..d544cfb47 100644 --- a/src/backend/langflow/interface/agents/custom.py +++ b/src/backend/langflow/interface/agents/custom.py @@ -252,7 +252,11 @@ class VectorStoreRouterAgent(CustomAgentExecutor): ): """Construct a vector store router agent from an LLM and tools.""" - tools = vectorstoreroutertoolkit.get_tools() + tools = ( + vectorstoreroutertoolkit + if isinstance(vectorstoreroutertoolkit, list) + else vectorstoreroutertoolkit.get_tools() + ) prompt = ZeroShotAgent.create_prompt(tools, prefix=VECTORSTORE_ROUTER_PREFIX) llm_chain = LLMChain( llm=llm,