File tree 1 file changed +5
-4
lines changed
templates/components/multiagent/python/app/examples
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ def _create_query_engine_tool() -> QueryEngineTool:
14
14
"""
15
15
index = get_index ()
16
16
if index is None :
17
- raise ValueError ( "Index not found. Please create an index first." )
17
+ return None
18
18
top_k = int (os .getenv ("TOP_K" , 0 ))
19
19
query_engine = index .as_query_engine (
20
20
** ({"similarity_top_k" : top_k } if top_k != 0 else {})
@@ -35,11 +35,12 @@ def _get_research_tools() -> QueryEngineTool:
35
35
Researcher take responsibility for retrieving information.
36
36
Try init wikipedia or duckduckgo tool if available.
37
37
"""
38
+ tools = []
39
+ query_engine_tool = _create_query_engine_tool ()
40
+ if query_engine_tool is not None :
41
+ tools .append (query_engine_tool )
38
42
researcher_tool_names = ["duckduckgo" , "wikipedia.WikipediaToolSpec" ]
39
- # Always include the query engine tool
40
- tools = [_create_query_engine_tool ()]
41
43
configured_tools = ToolFactory .from_env (map_result = True )
42
- print (configured_tools )
43
44
for tool_name , tool in configured_tools .items ():
44
45
if tool_name in researcher_tool_names :
45
46
tools .extend (tool )
You can’t perform that action at this time.
0 commit comments