Metadata-Version: 2.4
Name: tooltrace-llamaindex
Version: 0.1.0
Summary: LlamaIndex integration for ToolTrace web intelligence API
Project-URL: Homepage, https://tooltrace.io
Project-URL: Documentation, https://tooltrace.io/docs
Project-URL: Repository, https://github.com/ToolTrace-io/tooltrace-llamaindex
Author-email: ToolTrace <info@tooltrace.io>
License-Expression: MIT
License-File: LICENSE
Keywords: llama-index,llamaindex,rag,reader,tooltrace,web-scraping
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: llama-index-core>=0.11.0
Requires-Dist: tooltrace>=0.1.0
Description-Content-Type: text/markdown

# ToolTrace LlamaIndex Integration

[LlamaIndex](https://llamaindex.ai) data reader for the [ToolTrace](https://tooltrace.io) web intelligence API. Load webpages as LlamaIndex Documents with clean Markdown content for RAG pipelines and knowledge bases.

## Install

```bash
pip install tooltrace-llamaindex
```

## Quick start

```python
from tooltrace_llamaindex import ToolTraceReader

reader = ToolTraceReader(api_key="your-key")

docs = reader.load_data(
    urls=[
        "https://example.com/blog/post-1",
        "https://example.com/blog/post-2",
    ]
)

for doc in docs:
    print(doc.metadata["title"])
    print(doc.text[:200])
```

## RAG pipeline example

```python
from llama_index.core import VectorStoreIndex

from tooltrace_llamaindex import ToolTraceReader

# Load and index
reader = ToolTraceReader(api_key="your-key")
docs = reader.load_data(urls=["https://tooltrace.io/docs"])
index = VectorStoreIndex.from_documents(docs)

# Query
engine = index.as_query_engine()
response = engine.query("How does browser rendering work?")
print(response)
```

## Document metadata

Each document includes:

- `source`: Final URL after redirects
- `title`: Page title
- `canonical_url`: Canonical URL
- `author`: Author name
- `language`: Content language
- `published_at`: Publication date
- `word_count`: Word count
- `render_method`: Whether static or browser rendering was used
- `content_hash`: Content hash for change detection

## Options

```python
reader = ToolTraceReader(
    api_key="your-key",        # or set TOOLTRACE_API_KEY env var
    render="auto",             # "never" (1 credit), "auto", "always" (5 credits)
    continue_on_error=True,    # skip failed URLs instead of raising
)
```

## License

MIT
