Welcome to Moorcheh Python SDK
The Moorcheh Python SDK provides a simple and intuitive interface to integrate Moorcheh’s powerful semantic search and generative AI capabilities into your Python applications. With full API coverage, automatic authentication handling, and robust error management, the SDK makes it easy to build intelligent applications.Installation
Install the SDK using pip:Quick Start
Authentication
Get your API key from console.moorcheh.ai/api-keys. Set your API key as an environment variable:Basic Example
Here’s a complete example showing how to create a namespace, upload documents, search, and generate an answer:Key Features
Full API Coverage
Manage namespaces, ingest data, perform searches, and generate AI answers.
Simplified Authentication
Automatic handling of API keys via environment variables.
Robust Error Handling
Custom exceptions for specific API errors, allowing for graceful failure and recovery.
Context Management
The client is designed to be used as a context manager (with statement) for efficient handling of network resources.
SDK Structure
The SDK is organized into logical modules that mirror the API structure:Namespace Management
Create, list, and delete namespaces
Data Operations
Upload and manage text or vector data
Search & Discovery
Perform semantic search across namespaces
AI Generation
Generate AI-powered answers from your data
Basic Workflow
1
Initialize Client
Create a MoorchehClient instance, preferably using a context manager
2
Create a Namespace
Create a namespace to organize your data (text or vector type)
3
Upload Data
Upload text documents or vector embeddings to your namespace
4
Search
Perform semantic search to retrieve relevant data
5
Generate Answers
Use AI models to generate contextual answers from your data
Client Initialization
The MoorchehClient is the main entry point to the SDK. Learn more about client initialization and configuration.Next Steps
- Client Initialization - Learn how to configure the MoorchehClient
- Namespace Management - Create and manage namespaces
- Data Management - Upload and manage your data
- Search & AI - Perform searches and get AI answers
- Best Practices - Learn best practices and error handling