Skip to content

Commit d660592

Browse files
committed
Adapt to vector store, instead of vector DB API
1 parent eb540e3 commit d660592

4 files changed

Lines changed: 27 additions & 27 deletions

File tree

src/app/endpoints/query.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -675,10 +675,10 @@ async def retrieve_response( # pylint: disable=too-many-locals,too-many-branche
675675
),
676676
}
677677

678-
vector_db_ids = [
679-
vector_db.identifier for vector_db in await client.vector_dbs.list()
678+
vector_store_ids = [
679+
vector_store.id for vector_store in (await client.vector_stores.list()).data
680680
]
681-
toolgroups = (get_rag_toolgroups(vector_db_ids) or []) + [
681+
toolgroups = (get_rag_toolgroups(vector_store_ids) or []) + [
682682
mcp_server.name for mcp_server in configuration.mcp_servers
683683
]
684684
# Convert empty list to None for consistency with existing behavior
@@ -764,30 +764,30 @@ def validate_attachments_metadata(attachments: list[Attachment]) -> None:
764764

765765

766766
def get_rag_toolgroups(
767-
vector_db_ids: list[str],
767+
vector_store_ids: list[str],
768768
) -> list[Toolgroup] | None:
769769
"""
770-
Return a list of RAG Tool groups if the given vector DB list is not empty.
770+
Return a list of RAG Tool groups if the given vector store list is not empty.
771771
772772
Generate a list containing a RAG knowledge search toolgroup if
773-
vector database IDs are provided.
773+
vector store IDs are provided.
774774
775775
Parameters:
776-
vector_db_ids (list[str]): List of vector database identifiers to include in the toolgroup.
776+
vector_store_ids (list[str]): List of vector store identifiers to include in the toolgroup.
777777
778778
Returns:
779779
list[Toolgroup] | None: A list with a single RAG toolgroup if
780-
vector_db_ids is non-empty; otherwise, None.
780+
vector_store_ids is non-empty; otherwise, None.
781781
"""
782782
return (
783783
[
784784
ToolgroupAgentToolGroupWithArgs(
785785
name="builtin::rag/knowledge_search",
786786
args={
787-
"vector_db_ids": vector_db_ids,
787+
"vector_store_ids": vector_store_ids,
788788
},
789789
)
790790
]
791-
if vector_db_ids
791+
if vector_store_ids
792792
else None
793793
)

src/app/endpoints/query_v2.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,13 @@ async def retrieve_response( # pylint: disable=too-many-locals,too-many-branche
193193
# Prepare tools for responses API
194194
tools: list[dict[str, Any]] = []
195195
if not query_request.no_tools:
196-
# Get vector databases for RAG tools
197-
vector_db_ids = [
198-
vector_db.identifier for vector_db in await client.vector_dbs.list()
196+
# Get vector stores for RAG tools
197+
vector_store_ids = [
198+
vector_store.id for vector_store in (await client.vector_stores.list()).data
199199
]
200200

201-
# Add RAG tools if vector databases are available
202-
rag_tools = get_rag_tools(vector_db_ids)
201+
# Add RAG tools if vector stores are available
202+
rag_tools = get_rag_tools(vector_store_ids)
203203
if rag_tools:
204204
tools.extend(rag_tools)
205205

@@ -326,15 +326,15 @@ async def retrieve_response( # pylint: disable=too-many-locals,too-many-branche
326326
return summary, conversation_id
327327

328328

329-
def get_rag_tools(vector_db_ids: list[str]) -> list[dict[str, Any]] | None:
330-
"""Convert vector DB IDs to tools format for responses API."""
331-
if not vector_db_ids:
329+
def get_rag_tools(vector_store_ids: list[str]) -> list[dict[str, Any]] | None:
330+
"""Convert vector store IDs to tools format for responses API."""
331+
if not vector_store_ids:
332332
return None
333333

334334
return [
335335
{
336336
"type": "file_search",
337-
"vector_store_ids": vector_db_ids,
337+
"vector_store_ids": vector_store_ids,
338338
"max_num_results": 10,
339339
}
340340
]

src/app/endpoints/streaming_query.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,10 +1015,10 @@ async def retrieve_response(
10151015
),
10161016
}
10171017

1018-
vector_db_ids = [
1019-
vector_db.identifier for vector_db in await client.vector_dbs.list()
1018+
vector_store_ids = [
1019+
vector_store.id for vector_store in (await client.vector_stores.list()).data
10201020
]
1021-
toolgroups = (get_rag_toolgroups(vector_db_ids) or []) + [
1021+
toolgroups = (get_rag_toolgroups(vector_store_ids) or []) + [
10221022
mcp_server.name for mcp_server in configuration.mcp_servers
10231023
]
10241024
# Convert empty list to None for consistency with existing behavior

src/app/endpoints/streaming_query_v2.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,13 @@ async def retrieve_response(
365365
# Prepare tools for responses API
366366
tools: list[dict[str, Any]] = []
367367
if not query_request.no_tools:
368-
# Get vector databases for RAG tools
369-
vector_db_ids = [
370-
vector_db.identifier for vector_db in await client.vector_dbs.list()
368+
# Get vector stores for RAG tools
369+
vector_store_ids = [
370+
vector_store.id for vector_store in (await client.vector_stores.list()).data
371371
]
372372

373-
# Add RAG tools if vector databases are available
374-
rag_tools = get_rag_tools(vector_db_ids)
373+
# Add RAG tools if vector stores are available
374+
rag_tools = get_rag_tools(vector_store_ids)
375375
if rag_tools:
376376
tools.extend(rag_tools)
377377

0 commit comments

Comments
 (0)