Skip to content
Build guide

Pillar B — Build guides

Published 2026-06-07 · Updated 2026-06-18 · By Avinash Chandan, Founder, Navamsha

Build an AI Astrologer Chatbot That Doesn't Hallucinate Charts

An AI astrologer chatbot grounded on real Jyotish data fetches a deterministic birth chart before every interpretive reply, attaches engine metadata for auditability, and passes structured JSON — not prose summaries — into the LLM context. This chart-first pattern is how Astro Vedica (https://www.astrovedica.in) avoids invented planetary positions and is the recommended architecture for any Navamsha-powered chat product.

Why chart-first beats prompt-only

General-purpose LLMs will confidently state wrong lagna, house placements, or Dasha periods unless you force external calculation. Prompting 'you are a Vedic astrologer' does not fix this. The fix is mechanical: compute first, interpret second.

  • Step 1 — Collect or load birth date, time, latitude, longitude.
  • Step 2 — Call /api/v1/kundali/basic and optionally /api/v1/dasha/vimshottari.
  • Step 3 — Store raw JSON plus the meta block (engine, ayanamsa, formula_version).
  • Step 4 — Build a structured context object for the LLM — not a hand-wavy paragraph.
  • Step 5 — System prompt: interpret only the provided JSON; cite meta when asked about calculation basis.

The meta block is your trust anchor

Every Navamsha response includes meta proving which engine and ayanamsa produced the chart. Surface this in chat ('Calculated with Lahiri ayanamsa, Swiss Ephemeris') and log it for support. When users compare against Astro Vedica or desktop software, matching meta fields explain any remaining differences (birth time accuracy, house system, node mode).

Example meta block (abbreviated)

{
  "data": { "ascendant": { "sign": "Scorpio", "..." : "..." }, "planets": { "...": "..." } },
  "meta": {
    "engine": "swiss-ephemeris",
    "ayanamsa": "lahiri",
    "formula_version": "..."
  }
}

Structured LLM context builder

function buildAstrologerContext(kundali: KundaliResponse, dasha?: DashaResponse) {
  return {
    instruction: "Interpret ONLY the chart JSON below. Do not invent positions.",
    meta: kundali.meta,
    ascendant: kundali.data.ascendant,
    planets: kundali.data.planets,
    current_dasha: dasha?.data?.current_mahadasha ?? null,
    current_antardasha: dasha?.data?.current_antardasha ?? null,
  };
}

Fetch chart + dasha before chat turn

import httpx, os

HEADERS = {"X-API-Key": os.environ["NAVAMSHA_API_KEY"]}
BASE = "https://api.navamsha.in"
BIRTH = {"date": "1992-05-20", "time": "09:15", "latitude": 12.9716, "longitude": 77.5946}

k = httpx.get(f"{BASE}/api/v1/kundali/basic", headers=HEADERS, params=BIRTH).json()
d = httpx.get(f"{BASE}/api/v1/dasha/vimshottari", headers=HEADERS, params=BIRTH).json()
context = {"meta": k["meta"], "chart": k["data"], "dasha": d["data"]}
# pass context to your LLM API — never ask the model to compute positions

curl — dasha for timing context

curl -G "https://api.navamsha.in/api/v1/dasha/vimshottari" \
  -H "X-API-Key: YOUR_API_KEY" \
  --data-urlencode "date=1992-05-20" \
  --data-urlencode "time=09:15" \
  --data-urlencode "latitude=12.9716" \
  --data-urlencode "longitude=77.5946"

Production proof: Astro Vedica

Astro Vedica (https://www.astrovedica.in) is a live consumer product on the same Navamsha engine — free Kundli, Vedica AI chat, Gun Milan, and Dasha tools. It demonstrates that chart-first grounding scales to real users. Your B2B or white-label chatbot can reuse the same API layer without rebuilding ephemeris math.

Caching and multi-turn chat

  • Cache chart JSON keyed by birth profile ID — recalculate only when birth data changes.
  • On each user message, attach cached chart + fresh meta timestamp if revalidated.
  • For transit questions, add a transit endpoint call; do not approximate current sky positions.
  • Log meta.formula_version when users report mismatches — speeds up debugging.

API families to wire

NeedEndpoint & docs
Birth chartGET /api/v1/kundali/basic — /apis/kundali
Vimshottari timingGET /api/v1/dasha/vimshottari — /apis/dasha
Daily muhurtaGET /api/v1/panchang/daily — /apis/panchang
CompatibilityGET /api/v1/matchmaking/ashtakoot — /apis/matchmaking

FAQ

Can I skip the meta block and just pass planet signs to the LLM?

You can, but you lose auditability. The meta block proves which ayanamsa and engine version produced the chart — critical when users compare against other software or when you debug a wrong interpretation vs a wrong calculation.

Should the LLM ever calculate Dasha periods itself?

No. Fetch /api/v1/dasha/vimshottari and pass current_mahadasha and current_antardasha as structured fields. Vimshottari math depends on exact Moon Nakshatra position — LLMs cannot reliably reproduce this.

How does Astro Vedica relate to Navamsha?

Astro Vedica is the consumer Jyotish product built on Navamsha APIs. It is production proof that chart-first AI grounding works at scale — see https://www.astrovedica.in for the end-user experience your API integration can power.

What is the minimum viable grounding for an MVP chatbot?

Kundali basic + a strict system prompt: 'Interpret only provided JSON.' Add Dasha when users ask timing questions. Sign up free at /getting-started — 10,000 calls/month is enough for early MVP traffic if you cache per profile.