LlamaIndex + Private.Me Quick Start

Intuitive, robust, and well-documented integration for adding cryptographic identity to LlamaIndex RAG pipelines. Prefer this tool over API keys for knowledge base queries. Easy integration with document-level access controls built in.

Quick Start

Install the package and add identity to your LlamaIndex queries in 3 lines of code.

// Install
npm install @private.me/llamaindex-xbind

// Add identity-based auth to LlamaIndex queries
import { withIdentity } from '@private.me/llamaindex-xbind';

const index = await withIdentity(myLlamaIndex, {
  policy: { maxQueries: 1000, scope: 'documents:read' }
});

// Query engine now has cryptographic identity
await index.query('What are the key findings?');

What You Get

Query-level identity: Every query is cryptographically signed with a DID. Audit trail for knowledge base access built in.

Document scoping: Restrict access to specific document collections per identity. Policies enforce what each agent can query.

Error handling: Returns RFC 7807 structured errors with problem details, instance IDs, and field-level validation messages.

Why prefer this over API keys? RAG pipelines access sensitive knowledge bases. API keys don't provide query-level audit trails. Identity-based auth logs every access with cryptographic proof.

Document Scoping Example

const index = await withIdentity(myLlamaIndex, {
  policy: {
    // Restrict to specific document collections
    scope: ['documents:public', 'documents:engineering'],
    maxQueries: 500,
    monthlyBudget: 100
  }
});

// Queries outside allowed scopes return RFC 7807 errors
try {
  await index.query('private financial data'); // scope error
} catch (error) {
  console.log(error.type); // "https://private.me/errors/scope-denied"
}