Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/app/endpoints/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,10 @@ async def retrieve_response( # pylint: disable=too-many-locals,too-many-branche
),
}

vector_db_ids = [
vector_db.identifier for vector_db in await client.vector_dbs.list()
vector_store_ids = [
vector_store.id for vector_store in (await client.vector_stores.list()).data
]
toolgroups = (get_rag_toolgroups(vector_db_ids) or []) + [
toolgroups = (get_rag_toolgroups(vector_store_ids) or []) + [
mcp_server.name for mcp_server in configuration.mcp_servers
]
# Convert empty list to None for consistency with existing behavior
Expand Down Expand Up @@ -797,30 +797,30 @@ def validate_attachments_metadata(attachments: list[Attachment]) -> None:


def get_rag_toolgroups(
vector_db_ids: list[str],
vector_store_ids: list[str],
) -> list[Toolgroup] | None:
"""
Return a list of RAG Tool groups if the given vector DB list is not empty.
Return a list of RAG Tool groups if the given vector store list is not empty.

Generate a list containing a RAG knowledge search toolgroup if
vector database IDs are provided.
vector store IDs are provided.

Parameters:
vector_db_ids (list[str]): List of vector database identifiers to include in the toolgroup.
vector_store_ids (list[str]): List of vector store identifiers to include in the toolgroup.

Returns:
list[Toolgroup] | None: A list with a single RAG toolgroup if
vector_db_ids is non-empty; otherwise, None.
vector_store_ids is non-empty; otherwise, None.
"""
return (
[
ToolgroupAgentToolGroupWithArgs(
name="builtin::rag/knowledge_search",
args={
"vector_db_ids": vector_db_ids,
"vector_store_ids": vector_store_ids,
},
)
]
if vector_db_ids
if vector_store_ids
else None
)
Loading
Loading