AI Astrology Chatbot - Conversational AI for Vedic Astrology

What Makes Vedika's AI Different

Vedika is an astrology API with built-in AI that understands natural language. Users can ask questions like:

  • "What career suits me based on my birth chart?"
  • "Will this year be good for starting a business?"
  • "What does my Saturn return mean?"
  • "When is the best time to get married?"
  • "Explain my Mangal Dosha in simple terms"

Basic Implementation

// Simple chatbot with Vedika AI
const { VedikaClient } = require('@vedika-io/sdk');

const vedika = new VedikaClient({ apiKey: process.env.VEDIKA_API_KEY });

async function handleUserQuery(question, birthDetails) {
    const result = await vedika.askQuestion({
        question,
        birthDetails: {
            datetime: birthDetails.datetime,
            latitude: birthDetails.latitude,
            longitude: birthDetails.longitude
        }
    });

    return result.response;
}

// Example usage
const answer = await handleUserQuery(
    "What career path suits me best?",
    {
        datetime: '1990-05-15T14:30:00+05:30',
        latitude: 28.6139,
        longitude: 77.2090
    }
);

console.log(answer);
// The answer is written for your user's chart and question. For example:
// "Your 10th house of career is governed by Saturn, which sits strong in
// its own sign here, indicating steady professional growth built on
// discipline rather than sudden leaps..."

Streaming for Real-Time UI

// Stream responses for better UX
async function streamingChat(question, birthDetails, onChunk) {
    let fullResponse = '';
    // askQuestionStream yields the data payload of each server-sent event (a JSON string)
    for await (const chunk of vedika.askQuestionStream({ question, birthDetails })) {
        let event;
        try { event = JSON.parse(chunk); } catch { continue; }

        if (event.text) {
            // "clause" event: the next piece of the answer
            fullResponse += event.text;
            onChunk(event.text); // Update UI in real-time
        } else if (event.response && !fullResponse) {
            // "completed" event with the whole answer (sent on its own for some languages)
            fullResponse = event.response;
            onChunk(event.response);
        }
    }

    return fullResponse;
}

// React component with streaming
function AstrologyChat({ userBirthDetails }) {
    const [messages, setMessages] = useState([]);
    const [currentResponse, setCurrentResponse] = useState('');

    async function sendMessage(question) {
        setMessages(prev => [...prev, { role: 'user', content: question }]);
        setCurrentResponse('');

        const fullResponse = await streamingChat(question, userBirthDetails, (chunk) => {
            setCurrentResponse(prev => prev + chunk);
        });

        setMessages(prev => [...prev, { role: 'assistant', content: fullResponse }]);
    }

    // ... render chat UI
}

Key Features

Context-Aware

AI has full access to user's birth chart when answering.

Accurate Data

Responses based on XALEN Ephemeris calculations.

Multi-Language

Ask questions and get responses in 30 languages.

Streaming

Real-time responses for better user experience.

Try Vedika's AI Chatbot Today

Natural language queries with accurate astronomical calculations. Streaming responses for modern UX. Free sandbox to start.

Get API Key