LunarTech / src /rag_tools.py
vishalkatheriya's picture
Upload 14 files
24773d4 verified
"""
RAG tools for the ADK agent.
The agent calls these tools to get context from uploaded PDFs.
"""
from rag import get_context_for_query
RAG_TOP_K = 8
def query_uploaded_documents(query: str) -> str:
"""
Retrieve relevant passages from the user's uploaded PDF documents
for a given question or topic.
Call this whenever the user asks about the content of their documents.
"""
if not query or not str(query).strip():
return "Please provide a non-empty question or topic to search the documents."
context = get_context_for_query(query.strip(), top_k=RAG_TOP_K)
if not context or not context.strip():
return (
"No documents have been indexed yet, or no relevant passages were found. "
"Ask the user to upload and index PDFs first, or try a different query."
)
return context