> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hystersis.com/llms.txt
> Use this file to discover all available pages before exploring further.

# LlamaIndex Integration

> Use Hystersis with LlamaIndex

# LlamaIndex Integration

Use Hystersis as a vector store in LlamaIndex.

## Installation

```bash theme={null}
pip install hystersis llama-index
```

## Vector Store

```python theme={null}
from llama_index.vector_stores import HystersisVectorStore
from llama_index import GPTVectorStoreIndex, SimpleDirectoryReader

# Load documents
documents = SimpleDirectoryReader('./data').load_data()

# Create vector store
vector_store = HystersisVectorStore(
    api_key="your-key"
)

# Create index
index = GPTVectorStoreIndex.from_documents(
    documents,
    vector_store=vector_store
)

# Query
query_engine = index.as_query_engine()
response = query_engine.query("What is machine learning?")
```

## Reader

```python theme={null}
from hystersis.integrations.llamaindex import AgentMemoryReader

reader = AgentMemoryReader(
    memory_type="user",
    api_key="your-key"
)

documents = reader.load_data(query="preferences")
```
