🐛 fix(custom.py): handle case where vectorstoreroutertoolkit is already a list
The constructor of VectorStoreRouterAgent expects a non-list object for vectorstoreroutertoolkit. However, in some cases, vectorstoreroutertoolkit is already a list. This commit fixes the issue by checking if vectorstoreroutertoolkit is a list and using it directly if it is.
This commit is contained in:
parent
deb056df32
commit
1f135d09ec
1 changed files with 5 additions and 1 deletions
|
|
@ -252,7 +252,11 @@ class VectorStoreRouterAgent(CustomAgentExecutor):
|
||||||
):
|
):
|
||||||
"""Construct a vector store router agent from an LLM and tools."""
|
"""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)
|
prompt = ZeroShotAgent.create_prompt(tools, prefix=VECTORSTORE_ROUTER_PREFIX)
|
||||||
llm_chain = LLMChain(
|
llm_chain = LLMChain(
|
||||||
llm=llm,
|
llm=llm,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue