8000 feat: Allow data_store_specs pass into ADK VAIS built-in tool by copybara-service[bot] · Pull Request #1388 · google/adk-python · GitHub
[go: up one dir, main page]

Skip to content

feat: Allow data_store_specs pass into ADK VAIS built-in tool #1388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025
Merged
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
11 changes: 11 additions & 0 deletions src/google/adk/tools/vertex_ai_search_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ def __init__(
self,
*,
data_store_id: Optional[str] = None,
data_store_specs: Optional[
list[types.VertexAISearchDataStoreSpec]
] = None,
search_engine_id: Optional[str] = None,
filter: Optional[str] = None,
max_results: Optional[int] = None,
Expand All @@ -49,6 +52,8 @@ def __init__(
data_store_id: The Vertex AI search data store resource ID in the format
of
"projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}".
data_store_specs: Specifications that define the specific DataStores to be
searched. It should only be set if engine is used.
search_engine_id: The Vertex AI search engine resource ID in the format of
"projects/{project}/locations/{location}/collections/{collection}/engines/{engine}".
Expand All @@ -64,7 +69,12 @@ def __init__(
raise ValueError(
'Either data_store_id or search_engine_id must be specified.'
)
if data_store_specs is not None and search_engine_id is None:
raise ValueError(
'search_engine_id must be specified if data_store_specs is specified.'
)
self.data_store_id = data_store_id
self.data_store_specs = data_store_specs
self.search_engine_id = search_engine_id
self.filter = filter
self.max_results = max_results
Expand All @@ -89,6 +99,7 @@ async def process_llm_request(
retrieval=types.Retrieval(
vertex_ai_search=types.VertexAISearch(
datastore=self.data_store_id,
data_store_specs=self.data_store_specs,
engine=self.search_engine_id,
filter=self.filter,
max_results=self.max_results,
Expand Down
Loading
0