Vane AI Answering Engine

repository·master·Indexed 10 days ago

https://github.com/itzcrazykns/vane

A privacy-focused AI answering engine designed for local hardware. Vane integrates web search via SearxNG with AI providers such as Ollama, OpenAI, and Claude to provide cited, accurate answers. Built with Next.js, it features a pipeline for query classification, parallel research, and widget execution. It includes a programmatic API for chat, search, image, and video queries, and supports deployment via Docker and Docker Compose.

Tokens
16.3K
Snippets
63
Records
91
Agent score
98%

What's inside Vane

  1. Overview of Vane Architecture

    master
    Vane is a Next.js-based application that integrates an AI chat experience with search capabilities. The system is designed to classify user queries, perform parallel research and widget execution, and generate final answers complete with citations. It utilizes Large Language Models (LLMs) for reasoning and writing, embedding models for semantic search over uploaded files, and a meta-search backend for web research.
  2. How Vane processes questions

    master

    When a user sends a message via the UI, the application invokes the POST /api/chat endpoint. The processing pipeline follows three main stages:

    1. Classification: The system analyzes the question to determine if research is required, which widgets to display, and how to rewrite the question for better clarity.
    2. Parallel Execution: The system runs Research (web lookups or searching uploaded files) and Widgets (structured helpers like weather, stocks, or calculations) simultaneously.
    3. Answer Generation: Once context is gathered, a chat model generates the final response, incorporating citations from the gathered sources.
  3. Understand Vane Widgets and Research

    master

    Vane uses two distinct mechanisms to augment answers:

    Widgets

    Widgets are small, structured helpers (e.g., weather, stocks, calculations) that run in parallel with research. They are displayed in the UI immediately while the main answer is being generated. Note that widgets provide context but are not intended to be cited by the model.

    Research

    Research is the process of gathering background information. Depending on your configuration, this includes performing web lookups and searching through user-uploaded files.

  4. Handle streaming search responses

    master

    When stream: true is passed in the request, the API returns a text/event-stream using Server-Sent Events (SSE). Each line is a newline-delimited JSON object.

    Message Types:

    • init: Initial connection message (data contains "Stream connected").
    • sources: An array of all sources used in the response.
    • response: Chunks of the generated answer text.
    • done: Indicates the stream is complete.
    {"type":"init","data":"Stream connected"}
    {"type":"sources","data":[...]}
    {"type":"response","data":"Vane is an "}
    {"type":"response","data":"innovative..."}
    {"type":"done"}
  5. Update Vane using pre-built Docker images

    master

    If you are using pre-built Docker images, update Vane by pulling the latest image and recreating the container. Your settings are preserved automatically if you are using a named volume like vane-data.

    For the standard image:

    docker pull itzcrazykns1337/vane:latest
    docker stop vane
    docker rm vane
    docker run -d -p 3000:3000 -v vane-data:/home/vane/data --name vane itzcrazykns1337/vane:latest

    For the slim version (requires SEARXNG_API_URL environment variable):

    docker pull itzcrazykns1337/vane:slim-latest
    docker stop vane
    docker rm vane
    docker run -d -p 3000:3000 -e SEARXNG_API_URL=http://your-searxng-url:8080 -v vane-data:/home/vane/data --name vane itzcrazykns1337/vane:slim-latest

    After updating, verify the changes at http://localhost:3000.

  6. Install Vane with an existing SearxNG instance

    master

    If you already have a SearxNG instance running, use the slim version of the Vane Docker image. You must provide the SEARXNG_API_URL environment variable.

    Requirements for your SearxNG instance:

    1. JSON format must be enabled in SearxNG settings.
    2. Wolfram Alpha search engine must be enabled.

    Run the following command:

    docker run -d -p 3000:3000 -e SEARXNG_API_URL=http://your-searxng-url:8080 -v vane-data:/home/vane/data --name vane itzcrazykns1337/vane:slim-latest

    Replace http://your-searxng-url:8080 with your actual SearxNG URL.

  7. Configure Vane as a browser search engine

    master

    You can add Vane as a shortcut in your browser's search bar to perform searches directly from the address bar.

    1. Open your browser's settings and navigate to Search Engines.
    2. Add a new site search with the following URL format: http://localhost:3000/?q=%s

    Note: If Vane is hosted on a different machine or domain, replace localhost with your server's IP address or domain name, and ensure the port (default 3000) is correct.

    http://localhost:3000/?q=%s
  8. Install Vane from source (Non-Docker)

    master

    To install Vane without Docker, you must first install SearXNG manually and ensure JSON format and the Wolfram Alpha engine are enabled in its settings.

    Follow these steps:

    1. Clone the repository:
      git clone https://github.com/ItzCrazyKns/Vane.git
      cd Vane
    2. Install dependencies:
      npm i
    3. Build the application:
      npm run build
    4. Start the application:
      npm run start

    Access the setup screen at http://localhost:3000 to configure your environment.

    git clone https://github.com/ItzCrazyKns/Vane.git
    cd Vane
    npm i
    npm run build
    npm run start
  9. Update Vane by building Docker images from source

    master

    If you manage Vane by building your own Docker images from the source code, follow these steps:

    1. Pull the latest changes from the repository:
      cd Vane
      git pull origin master
    2. Rebuild the local Docker image:
      docker build -t vane .
    3. Replace the existing container with the new build:
      docker stop vane
      docker rm vane
      docker run -p 3000:3000 -p 8080:8080 --name vane vane

    Verify the update at http://localhost:3000 once the process completes.

    cd Vane
    git pull origin master
    docker build -t vane .
    docker stop vane
    docker rm vane
    docker run -p 3000:3000 -p 8080:8080 --name vane vane
  10. Install Vane using Docker (Recommended)

    master

    The easiest way to run Vane is via Docker. The standard image includes both Vane and a bundled SearxNG search engine, so no additional setup is required for the search backend.

    Run the following command to pull and start the container:

    docker run -d -p 3000:3000 -v vane-data:/home/vane/data --name vane itzcrazykns1337/vane:latest
    • -p 3000:3000: Maps the web interface to port 3000.
    • -v vane-data:/home/vane/data: Creates a persistent volume for your data and uploaded files.

    Once running, access the interface at http://localhost:3000 to configure API keys and models.

  11. Update Vane for non-Docker installations

    master

    To update a non-Docker installation of Vane, pull the latest source code, update dependencies, rebuild, and restart the application:

    1. Pull the latest changes:
      cd Vane
      git pull origin master
    2. Install new dependencies:
      npm i
    3. Rebuild the application:
      npm run build
    4. Restart the application:
      npm run start

    Settings are preserved automatically. Verify the update at http://localhost:3000.

    cd Vane
    git pull origin master
    npm i
    npm run build
    npm run start
  12. Configure answer generation optimization mode

    master

    You can control the tradeoff between response speed and the quality of the generated answer using the optimizationMode setting.

    Available modes:

    • speed: Prioritizes fast response times.
    • balanced: A middle ground between speed and quality.
    • quality: Prioritizes the depth and accuracy of the generated response.