# PageIndexMCTS

PageIndexMCTS is a Python library that implements Monte Carlo Tree Search (MCTS) for efficient page indexing and retrieval, integrated with Large Language Models (LLMs).

## Features

- **MCTS Implementation**: Includes standard MCTS and Hybrid MCTS (PUCT) algorithms.
- **LLM Integration**: Supports using LLMs (like ChatGPT) for value estimation and policy priors.
- **Parallel Search**: Optimized for performance with parallel simulation steps.
- **Document Indexing**: Tools for indexing PDF and Markdown documents.

## Installation

You can install the package directly from source:

```bash
pip install .
```

## Usage

See the `example` directory for usage demonstrations.

### Basic MCTS Search

```python
from search.tree.mcts import PageIndexMCTS

# Initialize your structure and query
# ...
search = PageIndexMCTS(structure, query, use_llm=True, n_threads=4)
search.run_search(iterations=50)
results = search.get_top_results(n=3)
```

## License

This project is licensed under the MIT License - see the LICENSE file for details.
