CoolFace
Apppublic

VizuaraAI/ramco-chat

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes
App README

ramco-chat

Natural-language chat interface over Ramco ERP's Procure-to-Pay module. Pilot scope: Create Direct Purchase Order end-to-end, including capital / dropship / consignment PO types, conversational ambiguity handling, mid-flow Q&A, and master-data validation.

The agent is a deterministic resolver over a compiled knowledge base, with the LLM acting as a translator (slot extraction, intent classification, and warm phrasing). Every reply is defensible from the kb/ artifacts, the variant graph rules, and the live trace.

Try it

Use the Scenarios button in the top-right to load a pre-built prompt, or just type naturally:

  • —"Create a general PO from supplier ACME-001, buyer Maria Garcia, currency USD, 5 units of LAPTOP-X at 100 each, warehouse WH-A, need date 2026-07-15."
  • —"I need to cancel a PO" — agent will ask Hold vs Short-Close
  • —"Convert PR/2026/12345 into a purchase order"

Click on the observability pane on the left to see what the agent is doing — every router decision, slot extraction, resolver result, and rule firing is streamed live as a trace event.

Architecture (running)

ramco-chat/
  backend/
    config.py              Path resolution (kb_root + artifact_root)
    llm.py                 Gemini wrapper with on-disk response cache
    agent/
      kb.py                KnowledgeBase + JourneyKB
      state.py             AgentState (incl. SKIP_SENTINEL semantics)
      resolver.py          Deterministic variant resolver
      prompts.py           Router / intent / slot / qa / reply prompt templates
      llm_layer.py         Five LLM-backed functions (route, classify_intent,
                           extract_slots, answer_question, generate_reply)
      executor.py          Multi-API executor (validates against master_data_stub)
      trace.py             Structured trace recorder
      loop.py              AgentLoop.handle_turn — orchestrator
    service/
      sessions.py          Per-session AgentLoop registry
      app.py               FastAPI app + WebSocket + static frontend serving
    extractors/
      stage1_journeys.py … stage7_taxonomy.py
  frontend/                React + Vite, Wispr Flow design language
  kb/PO/create_direct_purchase_order/
    slots.json             14 screens, ~93 user-input slots
    api_map.json           10 save-submit APIs, full field tree
    slot_alias_map.json    91 slot ↔ API ↔ SP-param triples
    rules.json             4,883 classified rules
    variants.json          942 variant-graph edges
    slot_taxonomy.json     641 slots classified user_input / system_derived / internal / display_only
    master_data_stub.json  Supplier/item/buyer/warehouse valid-value tables

Local development

bash
cd ramco-chat
python3 -m venv .venv
. .venv/bin/activate
pip install -e ".[dev]"
cp .env.example .env       # then fill in GEMINI_API_KEY
pytest                     # 113 expected pass

Run the full stack (two terminals):

bash
# Terminal 1 — backend
uvicorn backend.service.app:app --host 127.0.0.1 --port 8765

# Terminal 2 — frontend (Vite proxies /ws + REST to backend automatically)
cd frontend && npm install && npm run dev   # → http://localhost:5173

Deployment (Hugging Face Spaces)

This repository ships with a multi-stage Dockerfile that builds the frontend, then serves both API and SPA from a single Python container on port 7860. To deploy:

  1. 1.Create a new Space with Docker SDK (this README's frontmatter wires up the title / colors / port).
  2. 2.Push this repo to the Space's git remote.
  3. 3.In Settings → Variables and secrets, add a single secret named GEMINI_API_KEY.
  4. 4.Wait for the build. The first cold-start initialises the kb (~5s).

The image does NOT contain any API keys. GEMINI_API_KEY is injected as a Space secret at runtime, never baked into the image.