Last updated

LlamaIndex Retriever Example

Use Papr search results as node inputs for LlamaIndex query pipelines.

Pattern

  1. Execute Papr search.
  2. Map results into LlamaIndex text nodes.
  3. Run response synthesis in your LlamaIndex stack.

Prerequisites

  • PAPR_MEMORY_API_KEY in your environment
  • LlamaIndex pipeline where you can inject retrieved nodes

Minimal Setup

  1. Run papr_search() with one query and user scope.
  2. Convert response memories into LlamaIndex nodes.

Python Skeleton

from papr_memory import Papr
import os

client = Papr(x_api_key=os.environ.get("PAPR_MEMORY_API_KEY"))

def papr_search(query: str, user_id: str):
    return client.memory.search(
        query=query,
        external_user_id=user_id,
        enable_agentic_graph=True,
        max_memories=20,
        max_nodes=15,
    )

Validation Checklist

  • Search returns memories and optional graph nodes.
  • Node conversion step preserves source IDs for traceability.

Troubleshooting

If no relevant nodes are returned, increase max_memories and verify that prior writes exist for the selected user scope.