Skip to main content

Error Handling

Properly handle errors and exceptions in your application.

SDK Exception Handling

REST API Error Responses

Performance Optimization

Document Chunking

Split large documents into smaller, meaningful chunks for better search results:
Recommended chunk sizes:
  • General documents: 500-1000 characters
  • Technical docs: 1000-2000 characters
  • Legal documents: 2000-3000 characters

Batch Operations

Upload data in batches for better performance:

Async Processing

For text namespaces, embedding generation is asynchronous. Add a small delay after upload:

Namespace Organization

Separate by Environment

Organize by Content Type

Version Management

Metadata Best Practices

Rich Metadata

Include comprehensive metadata for better filtering:

Consistent Metadata Schema

Maintain consistent metadata keys across documents:

Search Optimization

Optimize top_k

Choose the right number of results:

Use Metadata Filters

Combine semantic search with metadata for precision:

Set Thresholds

Filter low-relevance results:

AI Generation Best Practices

Choose the Right Model

Control Temperature

Use Custom Prompts

Security Best Practices

  • Use environment variables
  • Never commit keys to version control
  • Use secret management in production
  • Rotate keys regularly
  • Add exponential backoff for retries
  • Monitor API usage
  • Implement client-side throttling
  • Sanitize user inputs before searching
  • Validate metadata formats
  • Check file types before upload
  • Track API call volumes
  • Monitor error rates
  • Set up alerts for anomalies

Next Steps

Quick Start

Get started with Moorcheh

Use Cases

See real-world examples

API Reference

Complete API documentation

Support

Get help from our team