Spaces:
Running
Running
A newer version of the Gradio SDK is available: 6.15.1
BhashyamAI Project Skills & Development Guidelines
This document outlines the operational patterns and developer skills for the BhashyamAI Research Portal.
ποΈ Architecture & Stack
- Backend: FastAPI (Python). Serves static production frontend and handles Graph/Vector search.
- Frontend: React (TypeScript/Vite/Tailwind).
- Database: ArcadeDB (Graph/FTS) and ChromaDB (Vector).
- Schema: See DB_DESIGN.md for the authoritative graph structure and canonical metadata schema.
π Search & Research Logic
1. Hybrid Search Paradigm
- Precision FTS: Combined with vector search for optimal relevance.
- Node-Based Graph Search: Prioritize specialized traversal tools for high-efficiency entity discovery:
search_by_topic,search_by_character,search_by_author,search_by_location.
- Smart Disambiguation: Use
check_entity_type(name)to verify entity types (Character vs. Topic) before executing a search. - Robust Randomization: Set
is_random=Truein search tools to offload sampling to the database.
2. Scholarly Comparative Analysis
- System Prompt: Dynamically generated to guide LLM handling.
- Entity Linking: Use
entity://protocol for citations. - Cross-Scripture Search: Utilize
POST /api/search/entityfor paginated discovery across the entire graph.
3. Data-Driven Hierarchical Search
- Dynamic Discovery: Hierarchy prefixes and scripture metadata discovered via
SanatanConfig. - Regex-based Filtering:
hierarchical_pathfilters are permissive regex. - Consistent Ordering: All retrieval methods strictly ordered by
v._global_index ASC. - Graph-based TOC: Uses hierarchical graph traversal (DB_DESIGN.md).
π οΈ Development Practices
- Cypher Centralization: Always use
modules/db/cypher_templates.pyfor queries. - Observability: Decorate all tool functions with
@log_tool_entry(inmodules/db/logger_utils.py) to capture invocations and tracebacks. - Standardization First: Always canonicalize documents using
SanatanConfig().canonicalize_documentbefore returning API responses. - API Speed: Use
include_transliteration=Falseincanonicalize_documentfor high-volume or lean API endpoints.
π Standard Workflow
- Frontend Changes: Update code in
frontend/src. - Build: Run
npm run buildin thefrontend/directory. - Backend Changes: Add/modify endpoints in
server.pyor modules. - Validation:
uv run python tests/test_api_endpoints.pyuv run python tests/debug_...py(Graph consistency checks).
- Serving: Ensure production build is served by FastAPI.