GitHub

NanoSage Project Description

What is the project about?

NanoSage is an open-source, advanced research assistant that performs deep, recursive searches and generates comprehensive reports. It operates locally on a user's machine, leveraging small, efficient language models. It's designed to mimic the human research process, exploring related concepts and building a knowledge base from both web and local data sources.

What problem does it solve?

NanoSage addresses the challenge of conducting thorough, in-depth research efficiently. It automates the process of:

  1. Refining search queries: It uses a "chain-of-thought" approach to expand on the initial user query, breaking it down into more specific subqueries.
  2. Gathering relevant information: It searches both the web (using DuckDuckGo) and local files (PDFs, text files, images) to build a comprehensive knowledge base.
  3. Filtering out irrelevant information: It uses embedding models to calculate the relevance of each subquery and piece of information, preventing the search from going down irrelevant paths ("rabbit holes").
  4. Organizing and summarizing findings: It creates a structured Table of Contents (TOC) that represents the search path and provides summaries of the information found at each step.
  5. Generating a final report: It uses Retrieval-Augmented Generation (RAG) with a language model (like Gemma 2B) to synthesize the findings into a well-organized, multi-section Markdown report.

What are the features of the project?

  • Recursive Search: Explores subqueries to a specified depth, mimicking the branching nature of human research.
  • Relevance Filtering: Uses embedding models (ColPali, all-minilm) to ensure that only relevant subqueries and information are pursued.
  • Web and Local Search: Integrates information from both web searches (via DuckDuckGo) and local files.
  • Knowledge Base: Builds a structured knowledge base of relevant documents and snippets.
  • Table of Contents (TOC) Tracking: Maintains a hierarchical TOC that represents the search process and organizes the findings.
  • Summarization: Provides summaries of web pages, local documents, and search results.
  • RAG-based Report Generation: Uses a language model (Gemma 2B, optionally) to generate a final, comprehensive report.
  • Monte Carlo Exploration: Optionally samples random subqueries to discover potentially valuable but less obvious connections.
  • Configurability: Allows users to customize various parameters (search depth, relevance thresholds, retrieval models, etc.) via command-line arguments and a config.yaml file.
  • GPU Acceleration: Supports GPU acceleration (via CUDA) for faster processing.
  • Personality: You can specify a personality for the final report generation.

What are the technologies used in the project?

  • Python 3.8+
  • Ollama: For running language models locally (specifically Gemma 2B).
  • PyTorch: (Optional) For GPU acceleration.
  • Embedding Models: ColPali (default), all-minilm (lighter alternative) for calculating relevance.
  • DuckDuckGo Search API: For web searches.
  • Various Python Libraries: requirements.txt lists libraries for web scraping, text processing, embedding, and more (e.g., requests, beautifulsoup4, transformers, sentence-transformers).
  • YAML: For configuration files (config.yaml).
  • Markdown: For generating the final report.

What are the benefits of the project?

  • Efficiency: Automates the tedious aspects of research, saving time and effort.
  • Thoroughness: Explores multiple avenues of inquiry, ensuring a more comprehensive understanding of the topic.
  • Relevance: Focuses on relevant information, avoiding distractions and irrelevant tangents.
  • Organization: Provides a structured and organized report, making it easy to understand the findings.
  • Local Operation: Runs entirely on the user's machine, ensuring privacy and control over data.
  • Open Source: Allows for customization, extension, and community contributions.
  • Small Models: Uses relatively small language models, making it accessible to users with limited computational resources.

What are the use cases of the project?

  • Academic Research: Gathering information for papers, theses, and dissertations.
  • Market Research: Investigating industry trends, competitor analysis, and customer insights.
  • Technical Research: Exploring new technologies, understanding complex concepts, and troubleshooting problems.
  • Content Creation: Generating outlines and drafts for articles, blog posts, and reports.
  • Personal Knowledge Management: Building a personal knowledge base on topics of interest.
  • General Inquiry: Answering complex questions that require gathering information from multiple sources.
  • Learning: Exploring a new subject in a structured and comprehensive way.
NanoSage screenshot