Metadata-Version: 2.4
Name: vectorless-qv
Version: 0.2.0
Summary: Reasoning-based RAG for Excel financial models — no vectors, no chunking. Supports all major LLM providers.
License: MIT
Requires-Python: >=3.11
Requires-Dist: formulas>=1.2
Requires-Dist: openpyxl>=3.1
Requires-Dist: pandas>=2.0
Provides-Extra: all
Requires-Dist: anthropic>=0.30; extra == 'all'
Requires-Dist: boto3>=1.28; extra == 'all'
Requires-Dist: google-genai>=1.0; extra == 'all'
Requires-Dist: groq>=0.4; extra == 'all'
Requires-Dist: openai>=1.0; extra == 'all'
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.30; extra == 'anthropic'
Provides-Extra: azure
Requires-Dist: openai>=1.0; extra == 'azure'
Provides-Extra: bedrock
Requires-Dist: boto3>=1.28; extra == 'bedrock'
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.1; extra == 'dev'
Provides-Extra: google
Requires-Dist: google-genai>=1.0; extra == 'google'
Provides-Extra: groq
Requires-Dist: groq>=0.4; extra == 'groq'
Provides-Extra: ollama
Requires-Dist: openai>=1.0; extra == 'ollama'
Provides-Extra: openai
Requires-Dist: openai>=1.0; extra == 'openai'
Provides-Extra: together
Requires-Dist: openai>=1.0; extra == 'together'
Description-Content-Type: text/markdown

# Vectorless-QV

**Reasoning-based RAG for Excel financial models — no vectors, no chunking.**

Inspired by the [PageIndex](https://github.com/VectifyAI/PageIndex) architecture, Vectorless builds a hierarchical tree index of an Excel workbook and uses an LLM reasoning loop (via AWS Bedrock) to navigate it — just like a financial analyst would.

## Features

- **No vector database** — no embeddings, no similarity search
- **No chunking** — formulas and cell relationships stay intact
- **Hierarchical tree index** — sheets → tables → formulas → cells
- **LLM-driven reasoning** — parallel tool calls, search, drill-down
- **Formula tracing** — follows `=+PL!X118` across sheets
- **What-if analysis** — override cells and recalculate formulas
- **100% traceable** — every answer cites exact sheet, cell, and formula

## Installation

```bash
pip install -e .
```

Or from a built wheel:

```bash
pip install vectorless-qv
```

## Quick Start

### 1. Index a workbook

```bash
vectorless-qv index --file financials.xlsx
```

This creates two files:
- `financials.tree.json` — the hierarchical tree index
- `financials.parsed.json` — raw cell data for query-time lookups

### 2. Ask questions

```bash
# Single question
vectorless-qv query --file financials.xlsx -q "What is the gross margin?"

# Interactive mode
vectorless-qv query --file financials.xlsx

# With reasoning trace
vectorless-qv query --file financials.xlsx -q "How is EBITDA calculated?" -v
```

### 3. Inspect the tree

```bash
# Full overview
vectorless-qv inspect --file financials.xlsx

# Specific node
vectorless-qv inspect --file financials.xlsx --node s1_t0
```

## Python API

```python
from vectorless_qv import parse_workbook, build_tree, BedrockAgent
import json

# Parse and index
data = parse_workbook("financials.xlsx")
tree = build_tree(data)

# Query
agent = BedrockAgent(tree=tree, workbook_data=data, excel_path="financials.xlsx")
result = agent.query("What drives net income?")
print(result["answer"])
print(result["citations"])
```

## Configuration

| Env Variable | Default | Description |
|-------------|---------|-------------|
| `AWS_DEFAULT_REGION` | `us-east-1` | AWS region for Bedrock |
| `AWS_ACCESS_KEY_ID` | — | AWS credentials |
| `AWS_SECRET_ACCESS_KEY` | — | AWS credentials |

Override the model via CLI:

```bash
vectorless-qv query --file f.xlsx --model us.anthropic.claude-sonnet-4-5-20250929-v1:0 -q "..."
```

## Architecture

```
Excel File
    │
    ▼
┌──────────┐     ┌──────────┐     ┌──────────┐
│  Parser  │────▶│ Indexer   │────▶│ Tree JSON│
│(openpyxl)│     │(hierarchy)│     │  (ToC)   │
└──────────┘     └──────────┘     └──────────┘
                                       │
                                       ▼
                               ┌──────────────┐
                               │ Bedrock Agent │◀── User Question
                               │ (Claude LLM)  │
                               └──────┬───────┘
                                      │
                          ┌───────────┼───────────┐
                          ▼           ▼           ▼
                    drill_down   get_cells    search_rows
                    get_row      what_if      answer
```

## License

MIT
