Skip to content

locallens ask

Ask a question about your indexed files using RAG (Retrieval Augmented Generation).

Usage

bash
locallens ask <question> [OPTIONS]

Arguments

ArgumentRequiredDescription
questionYesThe question to ask about your files

Options

OptionDefaultDescription
--top-k8Number of chunks to retrieve for context
--namespacedefaultNamespace to query
--formatrichOutput format: rich or json

Prerequisites

Requires Ollama running locally:

bash
ollama pull qwen2.5:3b
ollama serve

Examples

bash
# Ask a question
locallens ask "What was the Q3 revenue?"

# Use more context chunks
locallens ask "Summarize the project architecture" --top-k 15

Rich output

In rich mode, the answer streams token by token to the terminal.

JSON output

bash
locallens ask "What was the Q3 revenue?" --format json
json
{
  "answer": "Based on the report, Q3 revenue was $4.2M, exceeding projections by 12%.",
  "sources": [
    {
      "file_path": "/Users/me/Documents/report.pdf",
      "file_name": "report.pdf",
      "file_type": ".pdf",
      "chunk_text": "Q3 revenue exceeded projections...",
      "chunk_index": 3,
      "score": 0.8742,
      "extractor": "pymupdf"
    }
  ],
  "model": "qwen2.5:3b",
  "duration_seconds": 5.23
}

Released under the MIT License.