CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-llamaindex

Data framework for your LLM application

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

storage.mddocs/

Storage System

Persistent storage backends for documents, indices, and vector data across different storage systems in LlamaIndex.TS.

Import

import { StorageContext, SimpleDocumentStore, SimpleVectorStore } from "llamaindex";

Overview

The storage system provides persistent backends for documents, indices, and vector data, enabling data persistence across application restarts and scalable storage solutions.

Storage Context

class StorageContext {
  static fromDefaults(options?: {
    docStore?: BaseDocumentStore;
    indexStore?: BaseIndexStore;
    vectorStore?: BaseVectorStore;
    persistDir?: string;
  }): StorageContext;
  
  persist(persistDir?: string): Promise<void>;
  
  docStore: BaseDocumentStore;
  indexStore: BaseIndexStore;
  vectorStore: BaseVectorStore;
}

Document Stores

interface BaseDocumentStore {
  addDocuments(documents: Document[]): Promise<void>;
  getDocument(docId: string): Promise<Document | undefined>;
  getAllDocuments(): Promise<Document[]>;
  deleteDocument(docId: string): Promise<void>;
}

class SimpleDocumentStore implements BaseDocumentStore {
  constructor();
  
  addDocuments(documents: Document[]): Promise<void>;
  getDocument(docId: string): Promise<Document | undefined>;
  getAllDocuments(): Promise<Document[]>;
  deleteDocument(docId: string): Promise<void>;
  
  persist(persistPath: string): Promise<void>;
  static fromPersistDir(persistDir: string): Promise<SimpleDocumentStore>;
}

Basic Usage

import { StorageContext, VectorStoreIndex } from "llamaindex";

// Create persistent storage
const storageContext = StorageContext.fromDefaults({
  persistDir: "./storage",
});

// Create index with persistent storage
const index = await VectorStoreIndex.fromDocuments(documents, {
  storageContext,
});

// Persist to disk
await storageContext.persist("./storage");

// Load from disk
const loadedContext = StorageContext.fromDefaults({
  persistDir: "./storage",
});

docs

chat-engines.md

document-processing.md

embeddings.md

index.md

llm-integration.md

query-engines.md

response-synthesis.md

settings.md

storage.md

tools.md

vector-indexing.md

tile.json