Skip to main content

What is LlamaIndex Integration?

The Moorcheh Vector Store integration with LlamaIndex provides a powerful way to build advanced document processing and retrieval systems. This integration combines Moorcheh’s lightning-fast semantic search with LlamaIndex’s sophisticated document processing capabilities.

Key Features

Document Processing

Advanced document loading, chunking, and processing with LlamaIndex

Vector Storage

Efficient vector storage and retrieval using Moorcheh’s MIB technology

Query Engine

Powerful query engine with metadata filtering and advanced search

AI Integration

Seamless integration with various AI models for generative answers

Installation

Install the required packages:

Quick Start

Import Required Libraries

Configure Logging

Load Moorcheh API Key

Document Processing

Load and Chunk Documents

Adjust chunk_size and chunk_overlap based on your document type and requirements. Larger chunks provide more context but may reduce precision.

Vector Store Setup

Initialize Vector Store

Configuration Parameters

  • namespace: Unique identifier for your vector store
  • namespace_type: “text” for text-based or “vector” for vector-based namespaces
  • vector_dimension: Dimension of vectors (None for text-based namespaces)
  • batch_size: Number of documents to process in each batch
  • add_sparse_vector: Whether to include sparse vectors for hybrid search

Create Vector Store Index

Querying the Vector Store

Basic Query

AI-Powered Query

Advanced Features

Metadata Filtering

Filter documents based on metadata:

Supported Filter Operators

EQ

Equal to

NEQ

Not equal to

GT

Greater than

GTE

Greater than or equal

LT

Less than

LTE

Less than or equal

IN

In list

NIN

Not in list

Multiple Filters

Configuration Options

Chunking Strategy

Customize how documents are chunked:

Batch Processing

Optimize batch size for your use case:

Sparse Vectors

Enable hybrid search with sparse vectors:

AI Models

Supported Models

Model Selection

Choose the best model for your use case:

Best Practices

Document Preparation

1

Organize Documents

Place documents in a structured directory for easy loading
2

Set Appropriate Chunk Size

Balance between context and precision (512-1024 characters)
3

Add Rich Metadata

Include file paths, dates, and other relevant metadata
4

Test Different Configurations

Experiment with different chunk sizes and overlap values

Performance Optimization

  • Use appropriate batch sizes based on your memory constraints
  • Enable sparse vectors for hybrid search when needed
  • Monitor API usage and rate limits
  • Cache frequently accessed results

Error Handling

Troubleshooting

Common Issues

  • Ensure MOORCHEH_API_KEY is set in environment variables
  • Check API key permissions and validity
  • Verify the key has access to the specified namespace
  • Check document file paths and formats
  • Ensure documents are readable and not corrupted
  • Verify directory structure for SimpleDirectoryReader
  • Adjust chunk size and overlap settings
  • Use metadata filters to narrow down results
  • Consider enabling sparse vectors for better search
  • Reduce batch size for large document collections
  • Process documents in smaller batches
  • Monitor memory usage during indexing

Debug Mode

Enable detailed logging for troubleshooting:

Advanced Usage

Custom Embeddings

Custom Vector Store

Examples

Financial Document Analysis

Further Resources

LlamaIndex Documentation

Complete LlamaIndex documentation and guides

Moorcheh SDK

Moorcheh Python SDK repository

Examples Repository

Practical examples and tutorials

Community Support

Join the LlamaIndex community

Support

Need help with the LlamaIndex integration?

Get Support

Contact our support team for assistance