Metadata-Version: 2.4
Name: grag-search
Version: 0.1.0
Summary: Fast grep-based document search for LLM agents. No embeddings, just speed.
Author-email: Alan Sepulveda <alan@teralmed.com>, Juan Ortiz <juanes@teral.ai>
License: MIT
Project-URL: Homepage, https://github.com/teral-americas/grag
Project-URL: Repository, https://github.com/teral-americas/grag
Project-URL: Issues, https://github.com/teral-americas/grag/issues
Keywords: llm,search,grep,rag,documents,ai,agents,pdf,markdown
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Indexing
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PyMuPDF>=1.23.0
Requires-Dist: python-docx>=0.8.11
Requires-Dist: openpyxl>=3.1.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Dynamic: license-file

# grag

**Fast grep-based document search for LLM agents. No embeddings, just speed.**

[![PyPI version](https://badge.fury.io/py/grag.svg)](https://badge.fury.io/py/grag)
[![Python versions](https://img.shields.io/pypi/pyversions/grag.svg)](https://pypi.org/project/grag/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Why grag?

- 10x faster than embeddings-based search for exact matches
- Zero cost - no API calls, no vector databases
- Precise - finds exact terms, not "similar" content
- Lightweight - minimal dependencies
- LLM-ready - returns context windows perfect for prompts

## Quick Start
```bash
pip install grag
```
```python
from grag import Grag

# Index your documents
store = Grag("./contracts")

# Search with context
results = store.search("late payment penalty", context_chars=500)

# Use in LLM prompt
for result in results:
    print(result.format_for_llm())
```

## Supported Formats

- PDF
- DOCX (Word)
- XLSX (Excel)
- CSV
- TXT
- Markdown (.md, .markdown)

## When to use grag vs RAG

**Use grag for:**
- Exact term matching (IDs, dates, specific clauses)
- Legal/medical documents with precise terminology
- Cost-sensitive applications
- Low-latency requirements

**Use RAG for:**
- Semantic similarity
- Multi-lingual fuzzy matching
- Conceptual queries

**Or use both:** grag first for exact matches, RAG as fallback.

## Development Status

v0.1.0 — Alpha release. The API is functional and tested. Feedback welcome.

## Contributing

Contributions welcome. Open an issue or PR on GitHub.

## License

MIT License - see [LICENSE](LICENSE) file for details.

## Author

Built by [Alan Sepulveda](https://github.com/alansep) for [Teral](https://teral.co) and the open source community.
