Perplexica: The Open-Source AI Search Engine Powered by Your Own LLMs

7月23日 Published inSearch Tools

Perplexica answers queries by searching the web and, crucially, explains its reasoning. Every response includes a comprehensive list of sources, allowing you to verify the information and decide for yourself if the AI has interpreted the facts correctly.

While inspired by Perplexity AI, Perplexica operates on your terms. You can utilize OpenAI’s cloud-based models or point the system to a local Llama 3 instance via Ollama. The choice of infrastructure is entirely yours.

Two Core Modes

  • Copilot Mode (In Development): This mode breaks down your original question into multiple search queries. It digs deeper into the web to uncover resources that a single search might overlook.
  • Normal Mode: A straightforward search process where Perplexica processes your query and returns a concise answer backed by citations.

Six Specialized Focus Modes

Not every query requires an exhaustive web crawl. Perplexica provides specialized lenses to refine your results:

  • All: Searches the entire web for broad answers.
  • Writing Assistant: Designed for generative tasks that do not require external citations.
  • Academic Search: Focuses specifically on scholarly articles and research papers.
  • YouTube Search: Surfaces relevant video content.
  • Wolfram Alpha Search: Best for handling complex computations and data-heavy queries.
  • Reddit Search: Pulls discussions, anecdotes, and community opinions from Reddit threads.

Why Real-Time Accuracy Matters

Many AI tools scrape data, embed it, and allow it to stagnate in a static index. Perplexica avoids this pitfall by using SearXNG as a meta-search engine. This ensures that search results are pulled live. Perplexica then re-ranks these findings to provide the most current information available without the massive overhead of a daily indexing process.

Installation: Choose Your Method

There are two primary ways to get started. Docker is the recommended approach for most users.

Docker (Recommended)

  1. Clone the repository:

    git clone https://github.com/ItzCrazyKns/Perplexica.git
    cd Perplexica
    
  2. Configure the system: Copy sample.config.toml to config.toml. Enter the API keys for the services you intend to use: OpenAI, Ollama URL (http://host.docker.internal:11434), Groq, Anthropic, Gemini, DeepSeek, or your preferred AI/ML API. You can skip any providers you don't plan to use.

  3. Launch the services:

    docker compose up -d
    
  4. Access the UI: After about a minute, open http://localhost:3000 in your browser.

Manual Setup (Non-Docker)

  1. Install SearXNG and ensure JSON format output is enabled.
  2. Clone the repository and configure the config.toml file as described above.
  3. Execute npm i, then npm run build, and finally npm run start.

Docker is generally preferred as it handles environment quirks automatically.

Troubleshooting Ollama Connections

If Ollama refuses to connect, it is usually because the backend cannot reach the API endpoint.

  • Verify the URL in your settings.
  • Windows/Mac: Use http://host.docker.internal:11434
  • Linux: Use http://<private_ip_of_host>:11434

Linux users may need to explicitly expose the Ollama service. Edit /etc/systemd/system/ollama.service and add the following line under the [Service] section:

Environment="OLLAMA_HOST=0.0.0.0:11434"

Then, run systemctl daemon-reload and systemctl restart ollama. Ensure your firewall is not blocking port 11434.

Using Perplexica as Your Default Search Engine

To streamline your search workflow, you can add Perplexica directly to your browser's address bar.

  1. Navigate to your browser's "Search engine" settings.
  2. Add a new site search using this URL format: http://localhost:3000/?q=%s
  3. Adjust the host and port if you are hosting Perplexica on a different machine.

Now, you can type your queries directly into the address bar to trigger a Perplexica search.

The API

Perplexica exposes its search capabilities via an API, allowing for easy integration into your own applications.

Endpoint: POST http://localhost:3000/api/search

Request Body Example:

{
  "chatModel": {
    "provider": "openai",
    "name": "gpt-4o-mini"
  },
  "embeddingModel": {
    "provider": "openai",
    "name": "text-embedding-3-large"
  },
  "optimizationMode": "speed",
  "focusMode": "webSearch",
  "query": "What is Perplexica",
  "history": [
    ["human", "Hi, how are you?"],
    ["assistant", "I am doing well, how can I help you today?"]
  ],
  "systemInstructions": "Focus on technical details about Perplexica's architecture.",
  "stream": false
}

Response (Non-streaming):

{
  "message": "Perplexica is an open-source AI-powered search engine...",
  "sources": [
    {
      "pageContent": "...",
      "metadata": {
        "title": "...",
        "url": "..."
      }
    }
  ]
}

For real-time results, set "stream": true and parse the resulting newline-delimited JSON chunks.

API Parameters at a Glance

  • chatModel (optional): The provider and specific model name for the LLM.
  • embeddingModel (optional): The provider and model used for similarity searches.
  • optimizationMode (optional): Setting this to speed prioritizes rapid response times.
  • focusMode (required): Select from webSearch, academicSearch, writingAssistant, wolframAlphaSearch, youtubeSearch, or redditSearch.
  • query (required): The question you want to ask.
  • history (optional): Previous conversation context as an array of [role, content] pairs.
  • systemInstructions (optional): Custom guidance to dictate the AI's tone or specific objectives.
  • stream (optional): Toggles streaming output.

Deployment Options

Built on Next.js, Perplexica is highly portable. Beyond running it on your local network, you can deploy it to cloud platforms like Sealos or CLAWCLOUD with a single click. Self-hosting ensures you are never locked into a specific vendor and that your search data remains under your control.

The Bottom Line

Perplexica provides an AI search experience that respects your technical stack. By hosting it yourself and selecting your own models, you get fresh, verifiable answers without sending your data to a third party. It is a clean, transparent alternative to the proprietary "black boxes" that currently dominate the search market.