Skip to content

Commit f120117

Browse files
fix: Updated tools playground to allow vdb selection (meta-llama#1960)
# What does this PR do? This PR lets users select an existing vdb to use with their agent on the tools page of the playground. The drop down menu that lets users select a vdb only appears when the rag tool is selected. Without this change, there is no way for a user to specify which vdb they want their rag tool to use on the tools page. I have intentionally left the RAG options sparse here since the full RAG options are exposed on the RAG page. ## Test Plan Without these changes the RAG tool will throw the following error: `name: knowledge_search) does not have any content ` With these changes the RAG tool works as expected. Signed-off-by: Michael Clifford <mcliffor@redhat.com>
1 parent b44f84c commit f120117

File tree

1 file changed

+21
-0
lines changed
  • llama_stack/distribution/ui/page/playground

1 file changed

+21
-0
lines changed

llama_stack/distribution/ui/page/playground/tools.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ def reset_agent():
3737
label="Available ToolGroups", options=builtin_tools_list, selection_mode="multi", on_change=reset_agent
3838
)
3939

40+
if "builtin::rag" in toolgroup_selection:
41+
vector_dbs = llama_stack_api.client.vector_dbs.list() or []
42+
if not vector_dbs:
43+
st.info("No vector databases available for selection.")
44+
vector_dbs = [vector_db.identifier for vector_db in vector_dbs]
45+
selected_vector_dbs = st.multiselect(
46+
label="Select Document Collections to use in RAG queries",
47+
options=vector_dbs,
48+
on_change=reset_agent,
49+
)
50+
4051
st.subheader("MCP Servers")
4152
mcp_selection = st.pills(
4253
label="Available MCP Servers", options=mcp_tools_list, selection_mode="multi", on_change=reset_agent
@@ -67,6 +78,16 @@ def reset_agent():
6778
on_change=reset_agent,
6879
)
6980

81+
for i, tool_name in enumerate(toolgroup_selection):
82+
if tool_name == "builtin::rag":
83+
tool_dict = dict(
84+
name="builtin::rag",
85+
args={
86+
"vector_db_ids": list(selected_vector_dbs),
87+
},
88+
)
89+
toolgroup_selection[i] = tool_dict
90+
7091
@st.cache_resource
7192
def create_agent():
7293
return Agent(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy