Skip to content

About

An AI-powered answer engine that queries multiple AI models at once and merges their responses into a single clear, reliable answer.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Mini-Perplexity

A small AI research assistant, inspired by Perplexity.

Instead of asking just one AI for an answer, Mini-Perplexity asks three of them to work together: two AI models answer your question at the same time, and a third AI acts as a "judge" that reads both answers and writes one final, clear reply.


The idea in plain language

Imagine you ask the same question to two knowledgeable friends.

  • Friend A gives you their answer.
  • Friend B gives you theirs.

Both answers are useful, but they might overlap, disagree slightly, or explain things differently. So you bring in a third friend who is good at summarizing. This friend reads both answers, removes repetition, settles any disagreements, keeps what's most accurate, and hands you one clean, easy-to-understand answer.

That third friend is the "judge." That is exactly how Mini-Perplexity works.


Why do this?

Different AI models have different strengths. One might be more detailed, another might be clearer or more up to date. By combining answers from multiple models and letting a judge pick the best parts, you usually get a better, more reliable answer than you would from any single model alone.


How it works (high-level design)

Here is the journey your question takes, step by step:

                    Your question
                          │
                          ▼
                 ┌─────────────────┐
                 │   index.js      │   Starting point
                 │ (asks the Q)    │
                 └────────┬────────┘
                          │
                          ▼
                 ┌─────────────────┐
                 │   helper.js     │   Sends the question to two AIs at once
                 └───┬─────────┬───┘
                     │         │
        ┌────────────▼─┐    ┌──▼────────────┐
        │  Groq        │    │  Google       │   The two AIs answer
        │ (Llama 3.3)  │    │  Gemini       │   in parallel
        └────────────┬─┘    └──┬────────────┘
                     │         │
                     └────┬────┘
                          │  both answers
                          ▼
                 ┌─────────────────┐
                 │   judge.js      │   A third AI (GPT-4) combines
                 │ (GPT-4 judge)   │   them into one clear answer
                 └────────┬────────┘
                          │
                          ▼
                   Final answer

Step by step

  1. You ask a question. The question is set inside index.js (for example, "What is an Array in JavaScript?").

  2. The question is sent to two AI models at the same time. helper.js sends your question to:

    • Groq (running the Llama 3.3 model)
    • Google Gemini (the Gemini 2.5 Flash model)

    Both run in parallel, so you don't wait twice as long. You get both answers at roughly the same time.

  3. A judge combines the answers. judge.js sends both answers to OpenAI's GPT-4, with instructions to:

    • merge them into one answer,
    • resolve any conflicts,
    • remove repeated information,
    • prefer facts that are correct,
    • and keep the language simple enough for a beginner.
  4. You get one final answer. The combined, simplified answer is printed to the screen.


The files in this project

File What it does
index.js The starting point. Holds the question and kicks everything off.
helper.js Sends the question to Groq and Gemini at the same time, then passes both answers to the judge.
judge.js The "judge." Uses GPT-4 to merge the two answers into one clear reply.
groqModels.json A reference list of models available on Groq.
.env Stores your secret API keys (never shared or uploaded).
package.json Lists the project's dependencies and settings.

The tools it uses

  • Node.js — the environment that runs the project.
  • OpenAI (GPT-4) — acts as the judge.
  • Groq (Llama 3.3) — one of the two answering models.
  • Google Gemini — the other answering model.
  • dotenv — safely loads the secret API keys.
  • axios — a helper library for making web requests.

Getting started

1. What you need first

An API key is like a password that lets the project talk to each AI service.

2. Install the project

Open a terminal inside the project folder and run:

cd 01-mini-perplexity
npm install

This downloads everything the project needs to run.

3. Add your API keys

Create a file named .env inside the 01-mini-perplexity folder and add your keys:

OPENAI_API_KEY="your-openai-key-here"
GROQ_API_KEY="your-groq-key-here"
GEMINI_API_KEY="your-gemini-key-here"

Keep this file private. It contains secrets and is already ignored by Git, so it won't be uploaded to GitHub.

4. Run it

node index.js

You'll see each AI's individual answer printed out, followed by the final combined answer from the judge.

5. Ask your own question

Open index.js and change the text inside init(...) to whatever you'd like to ask:

init('What is a function in JavaScript?')

A note on security

The .env file holds secret keys. Treat them like passwords:

  • Never share them or post them publicly.
  • If a key is ever exposed, regenerate (rotate) it from the provider's website.

In short

Mini-Perplexity shows a simple but powerful idea: ask several AI models, then let one more AI combine the best of their answers. The result is usually clearer and more trustworthy than relying on a single AI.

About

An AI-powered answer engine that queries multiple AI models at once and merges their responses into a single clear, reliable answer.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages