dev: add ADK agent with vector search tool and Google Cloud file storage implementation
This commit is contained in:
47
rag_agent/agent.py
Normal file
47
rag_agent/agent.py
Normal file
@@ -0,0 +1,47 @@
|
||||
# Copyright 2026 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""ADK agent with vector search RAG tool."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from google.adk.agents.llm_agent import Agent
|
||||
|
||||
from .config_helper import settings
|
||||
from .vector_search_tool import VectorSearchTool
|
||||
|
||||
# Create vector search tool with configuration
|
||||
vector_search_tool = VectorSearchTool(
|
||||
name='conocimiento',
|
||||
description='Search the vector index for company products and services information',
|
||||
embedder=settings.embedder,
|
||||
project_id=settings.project_id,
|
||||
location=settings.location,
|
||||
bucket=settings.bucket,
|
||||
index_name=settings.index_name,
|
||||
index_endpoint=settings.index_endpoint,
|
||||
index_deployed_id=settings.index_deployed_id,
|
||||
similarity_top_k=5,
|
||||
min_similarity_threshold=0.6,
|
||||
relative_threshold_factor=0.9,
|
||||
)
|
||||
|
||||
# Create agent with vector search tool
|
||||
root_agent = Agent(
|
||||
model=settings.agent_language_model,
|
||||
name=settings.agent_name,
|
||||
description='A helpful assistant for user questions.',
|
||||
instruction=settings.agent_instructions,
|
||||
tools=[vector_search_tool],
|
||||
)
|
||||
Reference in New Issue
Block a user