Download app/agent/tools.py from acpcchatbotadmin/acpcchatbot_testing_first: direct link, hf CLI and curl.
- Browser
- Download file 1.53 kB
-
https://huggingface.co/spaces/acpcchatbotadmin/acpcchatbot_testing_first/resolve/main/app/agent/tools.py
- Command line
-
hf download hf://spaces/acpcchatbotadmin/acpcchatbot_testing_first/app/agent/tools.py
-
curl -L -o tools.py https://huggingface.co/spaces/acpcchatbotadmin/acpcchatbot_testing_first/resolve/main/app/agent/tools.py
1.53 kB
| from langchain_core.tools import tool | |
| from app.retrieval.retriever import retrieve_and_rerank | |
| def qdrant_retrieval_tool(query: str) -> list[dict]: | |
| """Search the ACPC Gujarat knowledge base for information about admissions, | |
| eligibility criteria, important dates, required documents, counseling process, | |
| seat allotment, fees, merit lists, and related topics. | |
| Args: | |
| query: A search query about ACPC Gujarat admissions. | |
| Returns: | |
| List of relevant document chunks with metadata (text, file_name, url, score). | |
| """ | |
| documents = retrieve_and_rerank(query) | |
| results = [] | |
| for i, doc in enumerate(documents): | |
| meta = doc.metadata or {} | |
| results.append( | |
| { | |
| "rank": i + 1, | |
| "text": doc.page_content, | |
| "file_name": meta.get("file_name", ""), | |
| "url": meta.get("url", meta.get("page_id", "")), | |
| "score": float(meta.get("relevance_score", 0.0)), | |
| } | |
| ) | |
| return results | |
| def get_current_date_tool() -> str: | |
| """Get the current date and time in IST (Indian Standard Time). | |
| Useful for comparing against ACPC admission deadlines and important dates. | |
| Returns: | |
| Current date/time as a string (e.g. '03 April 2026, 14:30 IST'). | |
| """ | |
| from datetime import datetime | |
| import pytz | |
| ist = pytz.timezone("Asia/Kolkata") | |
| now = datetime.now(ist) | |
| return now.strftime("%d %B %Y, %H:%M IST") | |