DeepSearcher Documentation

repository·master·Indexed 26 days ago

https://github.com/zilliztech/deep-searcher

DeepSearcher is a framework for advanced search, evaluation, and reasoning using private data by combining LLMs with vector databases such as Milvus, Zilliz Cloud, and Azure AI Search. It features support for multiple LLM providers (including OpenAI, DeepSeek, and Anthropic), various embedding models, document loaders (PDF, Unstructured, Docling), and web crawlers (FireCrawl, Crawl4AI, Jina). The framework includes a CLI for data loading and querying, a FastAPI service for deployment, and an evaluation script to compare performance against naive RAG.

Tokens
12.2K
Snippets
56
Records
105
Agent score
92%

What's inside DeepSearcher

  1. Overview of DeepSearcher

    master
    DeepSearcher is a system designed for search, evaluation, and reasoning based on private data. It integrates advanced Large Language Models (LLMs) like OpenAI o1, o3-mini, DeepSeek, Grok 3, Claude 4 Sonnet, Llama 4, and QwQ with Vector Databases such as Milvus and Zilliz Cloud. It is intended for enterprise knowledge management, intelligent Q&A systems, and information retrieval.
  2. Choose a DeepSearcher usage method

    master

    DeepSearcher can be integrated into your workflow using one of three primary methods:

    1. Python API: Best for programmatic integration and custom logic.
    2. Command Line Interface (CLI): Best for quick tasks and terminal-based workflows.
    3. Web Service Deployment: Best for serving DeepSearcher as a scalable service.

    Refer to the specific guides for quick_start.md, cli.md, or deployment.md to begin.

  3. Key Features of DeepSearcher

    master

    DeepSearcher provides the following capabilities:

    • Private Data Search: Utilizes enterprise internal data securely, with optional integration of online content.
    • Vector Database Management: Supports Milvus and other vector databases with data partitioning for efficient retrieval.
    • Flexible Embedding Options: Compatible with multiple embedding models.
    • Multiple LLM Support: Supports various models including DeepSeek and OpenAI for Q&A and content generation.
    • Document Loader: Supports loading local files and (under development) web crawling.
  4. Configure DeepSearcher components

    master

    DeepSearcher allows customization of several core components through its configuration system. You can configure the following components:

    • LLM: Large Language Models used for query processing.
    • Embedding Models: Models used for generating text embeddings for vector retrieval.
    • Vector Database: The storage and retrieval system for vector embeddings.
    • File Loader: Handles loading and processing of various file formats.
    • Web Crawler: Gathers information from web sources.
  5. Run DeepSearcher in a Docker container

    master

    Run the built deepsearcher:latest image as a container. This command maps port 8000, sets the OPENAI_API_KEY environment variable, and mounts local directories for data, logs, and the config.yaml file to ensure persistence and configuration application.

    docker run -p 8000:8000 \
      -e OPENAI_API_KEY=your_openai_api_key \
      -v $(pwd)/data:/app/data \
      -v $(pwd)/logs:/app/logs \
      -v $(pwd)/deepsearcher/config.yaml:/app/deepsearcher/config.yaml \
      deepsearcher:latest
  6. Quick Start Demo with Python API

    master

    To run a basic DeepSearcher workflow, configure your LLM and Embedding providers, load data (local files or websites), and then execute a query. Ensure you have the necessary API keys (e.g., OPENAI_API_KEY) set in your environment variables.

    Note: If using web crawling, the FIRECRAWL_API_KEY environment variable is required.

  7. Set up the DeepSearcher documentation environment

    master

    To set up the local documentation environment using MkDocs, install the necessary dependencies and clone the repository.

    1. Install MkDocs and required plugins:
    pip install mkdocs mkdocs-material mkdocs-jupyter pymdown-extensions
    1. Clone the repository:
    git clone https://github.com/zilliztech/deep-searcher.git
    cd deep-searcher
    pip install mkdocs mkdocs-material mkdocs-jupyter pymdown-extensions
    
    git clone https://github.com/zilliztech/deep-searcher.git
    cd deep-searcher
  8. Configure embedding models in DeepSearcher

    master

    DeepSearcher uses embedding models to convert text into vector representations for semantic search. You can configure the embedding provider using the config.set_provider_config method, specifying the provider name and a dictionary of arguments (such as the model name).

    config.set_provider_config("embedding", "(EmbeddingModelName)", "(Arguments dict)")
  9. Run the DeepSearcher evaluation script

    master

    Use the evaluate.py script to compare the performance of DeepSearcher against naive RAG using the Recall@K metric. The evaluation currently supports the 2wikimultihopqa dataset.

    You can provide a configuration YAML file to specify your LLM, embedding model, and other provider parameters. To avoid re-loading the dataset into the vector database on subsequent runs, use the --skip_load flag.

    python evaluate.py \
    --dataset 2wikimultihopqa \
    --config_yaml ./eval_config.yaml \
    --pre_num 5 \
    --output_dir ./eval_output
  10. Verify DeepSearcher installation

    master

    After installation, you can verify that the package is correctly set up by initializing a Configuration object and importing the query function from deepsearcher.online_query.

    from deepsearcher.configuration import Configuration
    from deepsearcher.online_query import query
    
    # Initialize with default configuration
    config = Configuration()
    print("DeepSearcher installed successfully!")