How praveen-goml/genaitask works
Purpose and entry points
JARVIS is a Python assistant backend combining retrieval-augmented generation (RAG), conversational memory, and guarded natural-language-to-SQL. It exposes an HTTP API, plus CLI and Streamlit interfaces.
• API application: JARVIS/src/api/main.py
• Interactive clients: JARVIS/src/ui/cli.py, JARVIS/src/ui/streamlit_app.py
• API route surface: JARVIS/src/api/routes/chat.py, JARVIS/src/api/routes/sql.py, JARVIS/src/api/routes/health.py
API and session boundary
The API layer validates request/response payloads, dispatches chat and SQL requests, and provides a health endpoint. Session state is separated from request routing, allowing chat continuity to be managed independently of the transport layer.
• Schemas: JARVIS/src/api/schemas.py
• Session handling: JARVIS/src/api/session_store.py
• Chat route: JARVIS/src/api/routes/chat.py
Agent orchestration
The core agent is the central control point for user interactions. It coordinates the LLM, RAG context, memory, and available tools, selecting or composing these capabilities for a response rather than embedding that logic in UI or route code.
• Agent: JARVIS/src/core/agent.py
• LLM integration boundary: JARVIS/src/core/llm.py
• Tool integration: JARVIS/src/core/tools.py
Retrieval-augmented knowledge flow
Documents under data/documents are ingested, chunked, embedded/indexed, and retrieved to ground responses. Retrieval is isolated from agent orchestration, while chunking and vector persistence are separate concerns.
• Ingestion entry point: JARVIS/scripts/ingest.py
• RAG pipeline: JARVIS/src/core/rag.py
• Chunking and vector storage: JARVIS/src/core/chunking.py, JARVIS/src/core/vector_store.py
• Source corpus: JARVIS/data/documents
Conversational memory
Conversation memory is a distinct core subsystem, likely used by the agent alongside retrieved documents. This separates transient/session-level chat context from the durable knowledge corpus and relational database.
• Memory component: JARVIS/src/core/memory.py
• Agent consumer: JARVIS/src/core/agent.py
• API session boundary: JARVIS/src/api/session_store.py
Relational data and NL-to-SQL safety pipeline
Natural-language SQL requests follow a dedicated pipeline: inspect available schema, generate SQL, validate/guard it, then execute against the database layer. This is a material safety boundary: SQL generation is not directly coupled to API routing or agent internals.
• Pipeline and generator: JARVIS/src/nl2sql/pipeline.py, JARVIS/src/nl2sql/generator.py
• Guard and schema inspection: JARVIS/src/nl2sql/guard.py, JARVIS/src/nl2sql/schema_introspection.py
• Database models/access: JARVIS/src/db/database.py, JARVIS/src/db/models.py
Runtime, initialization, and infrastructure
The repository is a Python service with dependency definitions and container orchestration. Database setup and seed data are explicit operational stages, separate from document ingestion.
• Dependencies: JARVIS/requirements.txt
• Container runtime composition: JARVIS/docker-compose.yml
• Database lifecycle scripts: JARVIS/scripts/setup_db.py, JARVIS/scripts/seed_db.py
• Environment configuration: JARVIS/config/settings.py, JARVIS/.env.example
Main entry points: chat.py API routes · agent.py Assistant agent · main.py HTTP API · database.py Relational database
Components 22
Interfaces
- HTTP API
JARVIS/src/api/main.py - API routes · Chat, SQL, and health endpoints.
JARVIS/src/api/routes/chat.py - API schemas
JARVIS/src/api/schemas.py - Session store · Keeps chat continuity separate from transport.
JARVIS/src/api/session_store.py - CLI client
JARVIS/src/ui/cli.py - Streamlit client
JARVIS/src/ui/streamlit_app.py
Assistant Core
- Assistant agent · Composes LLM, retrieval, memory, and tools.
JARVIS/src/core/agent.py - LLM integration
JARVIS/src/core/llm.py - Tool integration
JARVIS/src/core/tools.py - Conversation memory
JARVIS/src/core/memory.py
Knowledge Retrieval
- Document ingestion
JARVIS/scripts/ingest.py - Document corpus
JARVIS/data/documents - RAG pipeline
JARVIS/src/core/rag.py - Chunking
JARVIS/src/core/chunking.py - Vector store
JARVIS/src/core/vector_store.py
SQL Data Pipeline
- NL-to-SQL pipeline · Generates, validates, and executes SQL.
JARVIS/src/nl2sql/pipeline.py - SQL generator
JARVIS/src/nl2sql/generator.py - SQL guard
JARVIS/src/nl2sql/guard.py - Schema inspection
JARVIS/src/nl2sql/schema_introspection.py - Relational database
JARVIS/src/db/database.py
Operations
- Database lifecycle
JARVIS/scripts/setup_db.py - Container runtime
JARVIS/docker-compose.yml
Connections 23
- CLI client → HTTP API: uses
- Streamlit client → HTTP API: uses
- HTTP API → API routes: mounts
- API routes → API schemas: validates with
- API routes → Session store: manages sessions
- API routes → Assistant agent: dispatches chat
- API routes → NL-to-SQL pipeline: dispatches SQL
- Assistant agent → LLM integration: invokes
- Assistant agent → Tool integration: uses
- Assistant agent → Conversation memory: reads and updates
- Assistant agent → RAG pipeline: retrieves context
- Document corpus → Document ingestion: source documents
- Document ingestion → Chunking: chunks
- Chunking → Vector store: indexes
- RAG pipeline → Vector store: queries
- NL-to-SQL pipeline → Schema inspection: inspects schema
- NL-to-SQL pipeline → SQL generator: generates SQL
- SQL generator → SQL guard: submits for validation
- SQL guard → Relational database: permits execution
- Schema inspection → Relational database: reads metadata
- Database lifecycle → Relational database: sets up and seeds
- Container runtime → HTTP API: runs
- Container runtime → Relational database: runs