Wednesday, August 12, 2026

How to Build an AI Astrologer

 


Can an LLM-based AI provide astrological advice and guidance? Given the fact that LLM platforms like ChatGPT and Claude, along with their agentic AI extensions, have been demonstrating mind-bending performance in complex, cognitive tasks, the question is no more academic. If they can perform complex logical analysis of science and mathematics problems, astrology should be easy. Not quite. There are certain challenges. 

Having looked at the issue of using computers to perform, or at least assist with, astrological predictions for over 20 years, the problem is fascinating. We know that the computational aspect -- calculating positions, etc., -- is completely deterministic and hence algorithmic. This can be done with conventional programming. However, the next part, the interpretation of horoscopes is extremely tricky because there are literally thousands and thousands of conditional situations -- programmatically referred to as IF-THEN-ELSE clauses -- that are difficult to enumerate let alone evaluate. Compounding this complexity is the fact that different authors offer different, and sometimes contradictory suggestions. That is where traditional programming -- deterministic and algorithmic -- breaks down. 

And this is where probabilistic, or rather statistical -- techniques used by LLMs to generate responses based on statistical patterns learned from massive text corpora,  become useful. But there are challenges.

First, how do you “feed” the horoscope to an LLM? You could of course scan a copy of the horoscope chart and upload it to the LLM and ask it to analyse it as an astrologer? Would it give an answer? Of course it will because an LLM will usually attempt an answer even when uncertain; in a sense, it never says “I don't know!”  This leads to the second problem. How accurate will this answer be? LLMs are notorious for hallucinating, or generating plausible sounding answers that are completely incorrect. Of course, a good astrologer would be able to spot errors but a non-astrologer, who would be the obvious user of this process, would never know whether to trust the answer or not. 

This has always been the weakness of traditional computer astrology. Creating the chart is deterministic, programmatically do-able and verifiable. Interpreting it is difficult and highly error prone. To overcome this we offer a hybrid approach. 

A vanilla LLM, like ChatGPT or Claude works on a training corpus consisting of millions of text documents. Based on these, it generates answers using statistical techniques coded into neural network “models”. These are black boxes and we cannot determine, or explain, the path from a question to the eventual answer. Retrieval Augmented Generation ( RAG) is a technique that is used to force an LLM to base its answers on a set of known text fragments and this is what we will use in our model.

Unlike conventional chat-based LLMs, Google's NotebookLM is a specialised (and still free) research assistant built around a very different architecture. Originally designed as a tool to assist research scholars, it expects that the user will first upload a set of documents -- in PDF, text etc -- into the Notebook. These documents are encoded as vectors and stored in a specialised vector database. When a question is asked, the most relevant fragments are retrieved and supplied to the transformer-based LLM as context. The LLM  primarily bases its answers on the uploaded sources. This provides a good guard against hallucinations.

But how exactly do we feed a horoscope to an LLM? Just supplying the locations of the planets is not good enough. Grahas reside in rashis but both grahas and rashis have a second meaning. Rashis have to be converted to houses ( or bhavs or ghars) based on their radial distance from either the Lagna (Ascendent) or from the Moon. Then each rashi has a Lord and both grahas and the lords view or aspect each other depending on whether radial distance between them is three, seven, nine rashis. Then there are conjuncts where lords or grahas are co-located in the same house or rashi. Finally there are specific combinations of grahas/lords in rashis/houses -- and there are literally hundreds of them -- which offer specific insights. Grahas and lords can be benefic or malefic and can be located in rashis that are hostile, helpful or indifferent. While all this may sound extremely complicated -- and believe me it is -- nevertheless this is rule-based. Given the date, time and location of a native's birth, all this can be calculated as per the logical rules that have been handed down from the dawn of history in classical texts like Brihat Parashara Hora Shastra and others.

Given that all of this is algorithmic, why burden an LLM with performing these calculations and arriving at  a probabilistic answer that is difficult to verify? Faced with this problem we define the following architecture .

Parashar21 is a Python-based tool that uses the Swiss Ephemeris astronomical software -- one of the most widely used high-precision astronomical ephemerides -- to generate the complex horoscope -- complete with grahas, rashis, lords, aspects and conjuncts. The Parashar 21 software was originally developed to create a human-readable MS-Word document that shows all this, both graphically -- in the North Indian, South Indian and also Bengali / East Indian style -- as well as with text descriptions. It also lists the Vimosottari Mahadasha/Antardasha periods for 120  years. This software has been under development for the past ten years and has been tested on many people and is almost certainly correct.  The output or report generation part of this software has now been modified to generate the same information as a structured text that any LLM -- including NotebookLM -- can understand.


The next task is to find authoritative texts in PDF format. This is not easy but not too difficult either. The internet in general and the Scribd platform in particular is a rich source of such PDF files and I could download many such including a scanned -- but 95% readable -- Hindi translation of the Brihat Parashar Hora Shastra. The two other texts that were used were Harihar Majumdar’s The Hindu Science of the Future and James Braha’s Ancient Hindu Astrology for Western Astrologers. Since I have physical copies of both books, I had no qualms about using the PDF version. However one can use BV Raman’s books, or any other book that they trust, as well.

The third and last piece of the task is to write the prompt. This has to be done carefully because the prompt must (a) specify that ONLY the sources supplied and nothing else on the internet is to be used (b) make sure that every observation or conclusion cites specific chapters, sections, or excerpted passages and finally ( c) define what should the output consist of and how it should be structured. One can build the prompt oneself, but it is easier to get another, possibly vanilla, LLM to build the prompt. We used ChatGPT to build the prompt that was used in NotebookLM and the results were quite good.

So how good are the results?  I would say that based on interpretations of known people, the results were quite good. No less than what would be expected from a reasonable astrologer and certainly far better than what I had received from a few astrology web sites that charge money. But of course it is always better for  you to check it out.

So how can you use my software and architecture to create a DIY astrology platform ?

The core Parasha21 software is available as free and open source in my GitHub repository. Unfortunately this is not a GUI based tool where  you can insert your details and the results will come pouring out. Sorry, I do not have the patience to build user friendly software, like say, Junior Jyotish. What we have is the full code available as a Google Colab python IPython notebook. While no Python programming is required, one would have to know how to access a Parashar21 GitHub repository (https://github.com/prithwis/parashar21), locate the correct Colab Notebook (currently P21_51_Chart2LLM.ipynb ), open it in Google Colab ( by pressing the little blue button), edit one line of code to replace the birth details of President APJ Abdul Kalam ( kept for demo purposes) with your own and then execute all the cells of the Notebook. This will generate two txt files, Chart.TXT and Dasha.TXT along with two human-readable Word documents -- remnants from the legacy implementation. These two files exist in the Google Colab Virtual Machine and have to be downloaded to your local laptop. Specifically, 

1. Open the Colab Notebook

2. Update the birth details line

3. Run the entire notebook

4. Open the left sidebar folder icon to download 'Chart.TXT' and 'Dasha.TXT'

Once again, let me reiterate that while there is no Python coding required, one would need a basic familiarity with a Python development environment. If  you do not have this familiarity, you could either take the help of a friend, who knows all this,  or better purchase “Structured Thinking with Python”, my textbook (available at https://store.pothi.com/book/prithwis-mukerjee-structured-thinking-python/)  for first year MBA students who join Praxis with no prior programming experience!.

Astrology is considered a pseudo-science in mainstream academia because its predictions are not repeatable, falsifiable or verifiable by traditional experimental techniques. Stripped of jargon, what this means is that we cannot understand or explain how this damn thing could works.  It is said that astrology is not explainable. However as I have written elsewhere [ see Astrology - an application of Data Science :  https://www.linkedin.com/pulse/astrology-an-application-data-science-prithwis-mukerjee/ ] , astrology is not about explaining causation but to identify correlations. This is no different from any neural-network-based artificial intelligence platform. Moreover, the fear of an inexplicable “spooky action at a distance” where a remote planet can influence a human on earth can be related to, in an indirect sense, to the concept of quantum entanglement. [  see Astrology as Quantum Entanglement :  https://www.linkedin.com/pulse/astrology-quantum-entanglement-prithwis-mukerjee/ ]  But anyway, this article is not to defend or justify astrology. If you have read so far, it means that you like it and believe in its potential.

Go ahead and check out how this dual-engine platform combines algorithms and neural networks to replicate a decent astrologer. All you need to try it is a Google Gmail ID -- nothing to install, and no code to write. With just a little curiosity and the patience to walk through a few steps, you can get started. Visit my GitHub repository today to launch your journey, now!

Friday, August 11, 2023

Major Update : AshtakVarga Points

 A whole new section on AshtakVarga Points has been added along with a major reorganisation and rationalisation of the code. Two new notebooks have been created that supersede most of the other notebooks.

  • P21_45_10_MultiChart_Analysis - This is the core project where we take the date, time and place of birth of a large number of people, cast their horoscopes, store these in a MongoDB database and retrieve some of them based on the presence of certain patterns ( or Yogs)
  • P21_45_09_Single_AshtakVarga_Gochar - This is an auxiliary, but more interesting project that focusses on the analysis of a single native in terms of Rashi horoscope, Navamsa, Aspects, Conjuncts, Exaltations, Debilitations, Vimsottari Dasha and Ashtakvarga points

Saturday, September 24, 2022

Major Updates

 Significant updates made to the Parashar21 software. Now we are in a position to spot and retrieve charts with specific patterns including some known Yogs. See the Github repository for more information.



Saturday, January 22, 2022

Migration to MongoDB

 The Parashar21 system has now been migrated to MongoDB and the results are very interesting.  We are now able to store horoscope charts as JSON objects in a MongoDB database and these objects can be accessed by values in the various fields.

For example, a query like this :

{"$and": [{"exaltG.Ju": {"$eq": true}}, {"GAspectedBy2.La": {"$in": ["Sa"]}}, {"GConjunctsG2.Su": {"$in": ["Me"]}}, {"GrahaBhava.Mo": {"$eq": 1}}, {"LordBhav.4": {"$eq": 5}}]}

which means retrieve charts that have

  1. Exalted Graha Jupiter and
  2. Lagna aspected by Saturn and
  3. Sun conjunct Mercury and
  4. Moon in 1st Bhav and
  5. Lord of 4th Bhav is in 5th Bhav

will retrieve the following TWO charts



A manual check will reveal that these charts do indeed meet the five conditions specified!
The programs for casting, storing and retrieving these charts are available in Github . A detailed paper explaining the logic behind is available at ResearchGate





Saturday, January 8, 2022

New Year, New Resolutions

 Parashar21 has come out of dormancy again with two new initiatives.

  1.  First, we are migrating to a MongoDB platform so that we can search for charts with greater elegance
  2. Second, we are migrating all our codes to Github so that it is easy for people to use.
Jai Parashar

Sunday, February 2, 2020

Horoscopes of 1100 Doctors

My Parashar21 python application was recently put to a good use in the search for common patterns in the horoscopes of similar people. My good friend Raghuram Hebbar, who is one of the inspirations and champions for this pattern matching approach, has some ideas on what is common to the horoscopes of doctors. If this is established, it would lead to a whole new perspective on astrology.

The first challenge in this case, is to get horoscopes of a large number of people who share similar characteristics. After a lot of effort, we located the Astro-Databank Wiki that contains the birth details of nearly 60,000 people along with -- and this is most crucial -- their profession and brief biodata. Unfortunately, the charts available in this database are based on the Western system of astrology and hence of little value to Indian astrologers.

So we have done the arduous task of taking only the date, time and place of birth data along with timezone adjustments from this database and generating the corresponding Rashi, Navamsa and Dasamsa charts as per Indian astrology, using the pythonic version of our chart casting software Parashar21.

Out of this 60,000 horoscopes, only about 40,000 are reliable as per the Rodden Rating of accuracy of birthtime. From these 40,000 we have taken birth details of about 1100 people whose vocation has been identified as 'Medicine' in the database. The actual charts of these doctors are now available in the public domain. If you have an interest in such matters, please download this file from this link.

Saturday, August 3, 2019

Parashar21 : pyswisseph

The fortuitous location of a python package pyswisseph  that implements ver 2.0 of the Swiss Ephmeris software means that the earlier way of running an executable file and then collecting the results is no more required. Now it is  possible to call the Swiss Ephemeris functions directly from Python code running in Jupyter notebook located on Google Colab. A skeletal demo of this approach is given in this demo notebook.

Based on this technology, two new programs or notebooks have been created. The first one casts the horoscope and stores it as a .py21 text file on the Colab VM -- which can then be saved either in Google-Drive or on local, desktop machine. The second program reads the data from the horoscope (.py21) file and does a Position-Aspect-Conjunction (PAC of KN Rao ) analysis and presents the data as MS Doc file with the horoscope chart embedded in it! Nice isn't it!

This is a work in progress but the Aug 3, 2019 version of these two program ( or Google Colab notebooks) is available as follows : (1) Parashar 21 - Cast V3  (2) Parashar21 - PAC V3.

Google Colab is the easiest way to run python programs without having to install anything on your machine. All  you need is Google Chrome browser and a GMail account. To learn about how to use Google Colab please Google for tutorials. Its extremely easy to use.