ask.py
Basic Information
ask.py is a single Python program that implements a search-extract-summarize flow to mimic AI search engines like Perplexity. Given a query it can search the web or use local files, crawl and scrape document text, chunk and store content in a vector store, run a hybrid vector and BM25 full-text search, optionally rerank results, and use an LLM to generate a summarized answer with references. It supports running as a command line tool or launching a Gradio web UI with GradIO sharing and can be scripted or run in cron jobs. The project also supports local inference and embedding providers, separate endpoints for inference and embeddings, and configurable behaviors such as date or site restriction, output language and length, extract mode for structured data, and scraping a specified list of URLs.