Metadata-Version: 2.4
Name: ppx-llamaindex
Version: 0.1.0a1
Summary: LlamaIndex integration for the Preference Profile Exchange (PPX).
Project-URL: Homepage, https://blazing-customs.github.io/ppx-spec/
Project-URL: Documentation, https://github.com/Blazing-Customs/ppx-sdks/tree/main/python/ppx-llamaindex#readme
Project-URL: Source, https://github.com/Blazing-Customs/ppx-sdks/tree/main/python/ppx-llamaindex
Project-URL: Repository, https://github.com/Blazing-Customs/ppx-sdks
Project-URL: Issues, https://github.com/Blazing-Customs/ppx-sdks/issues
Project-URL: Changelog, https://github.com/Blazing-Customs/ppx-sdks/blob/main/CHANGELOG.md
Author: Blazing Customs
License: Apache-2.0
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: llama-index-core>=0.11.0
Requires-Dist: ppx-client>=0.1.0a1
Description-Content-Type: text/markdown

# ppx-llamaindex

> LlamaIndex integration for the [Preference Profile Exchange (PPX)](https://blazing-customs.github.io/ppx-spec/).

## Install

```bash
pip install ppx-llamaindex
```

Requires Python 3.11+. Published version: **0.1.0a1** ([PyPI](https://pypi.org/project/ppx-llamaindex/)).

> Alpha, tracking a **draft** specification. Expect breaking changes.
> The version is `0.1.0a1` on PyPI and `0.1.0-alpha.1` on npm — the
> same release in each ecosystem's required format.

## Load claims as Documents

```python
from ppx_client import PpxClient
from ppx_llamaindex import PpxReader
from llama_index.core import VectorStoreIndex

client = PpxClient("https://api.provider.app")
reader = PpxReader(client, grant_token=my_grant_token,
                   effective_kwargs={"requested_namespaces": ["fragrance"]})
docs = reader.load_data()

index = VectorStoreIndex.from_documents(docs)
query = index.as_query_engine().query("What scent profile suits this user?")
```

## Use as a tool in an agent

```python
from llama_index.core.agent import ReActAgent
from llama_index.llms.openai import OpenAI
from ppx_llamaindex import ppx_preference_tool

tool = ppx_preference_tool(client, grant_token=my_grant_token)
agent = ReActAgent.from_tools([tool], llm=OpenAI(model="gpt-4o-mini"))
agent.chat("Recommend a trip based on my core preferences.")
```

## License

Apache-2.0.
