Skip to main content

Python SDK for the Moorcheh Semantic Search API

Project description

Fallback image description

The Information-Theoretic Search Engine for RAG & Agentic Memory

Learn more · Tutorials · Join Discord

Moorcheh Discord License: MIT Python Version Downloads Twitter / X

Why Moorcheh?

  • 32x Compression Ratio over traditional Vector DBs
  • 85% Reduced End-to-End Latency over Pinecone vector search + Cohere reranker
  • 0$ Storage Cost true serverless architecture scaling to 0 when idle
  • Read the full paper

Moorcheh is the universal memory layer for agentic AI, providing fast deterministic semantic search with zero‑ops scalability. Its MIB + ITS stack preserves relevance while reducing storage cost and decreasing latency, providing high‑accuracy semantic search without the overhead of managing clusters, making it ideal for production‑grade RAG, agentic memory, and semantic analytics.

🛠️ Key Capabilities

  • Bring any data: Ingest raw text, files, or vectors with a unified API.
  • One-shot RAG: Go from ingestion to grounded answers in a single flow.
  • Zero-ops scale: Serverless architecture that scales up and down automatically.
  • Infrastructure as code: Deploy into your cloud with native IaC templates.
  • Agentic memory: Stateful context for assistants and long-running agents.
  • Developer-ready: Async support, type hints, and clear error handling.

🚀 Quickstart Guide

Hosted Platform

Use our hosted platform to get up and running fast with managed indexing, zero-ops scaling, and usage-based billing.

Self-Hosted

  1. Install the SDK using pip:
pip install moorcheh-sdk
  1. Sign up and generate an API key through the Moorcheh platform dashboard.

  2. The recommended way is to set the MOORCHEH_API_KEY environment variable:

export MOORCHEH_API_KEY="YOUR_API_KEY_HERE"

Basic Usage

import os
from moorcheh_sdk import MoorchehClient

api_key = os.environ.get("MOORCHEH_API_KEY")

with MoorchehClient(api_key=api_key) as client:
    # Create a namespace
    namespace_name = "my-first-namespace"
    client.namespaces.create(namespace_name=namespace_name, type="text")

    # Upload a document
    docs = [{"id": "doc1", "text": "This is the first document about Moorcheh."}]
    upload_res = client.documents.upload(namespace_name=namespace_name, documents=docs)
    print(f"Upload status: {upload_res.get('status')}")

    # Add a small delay for processing before searching
    import time
    print("Waiting briefly for processing...")
    time.sleep(2)

    # Perform semantic search on the namespace
    search_res = client.similarity_search.query(namespaces=[namespace_name], query="Moorcheh", top_k=1)
    print("Search results:")
    print(search_res)

    # Get a Generative AI Answer
    gen_ai_res = client.answer.generate(namespace=namespace_name, query="What is Moorcheh?")
    print("Generative Answer:")
    print(gen_ai_res)

For more detailed examples covering vector operations, error handling, and logging configuration, please see the examples directory.

API Client Methods

The MoorchehClient and AsyncMoorchehClient classes provide the same method signatures. Below is a list of the available methods.

Methods Required Parameters Description
namespaces.create namespace_name, type, vector_dimension Create a text or vector namespace.
namespaces.list N/A List all available namespaces.
namespaces.delete namespace_name Delete a namespace by name.
documents.upload namespace_name, documents Upload text documents to a text namespace.
documents.get namespace_name, ids Retrieve documents by ID.
documents.upload_file namespace_name, file_path Upload a file for server-side ingestion.
documents.list_files namespace_name List raw files in storage for a namespace.
documents.delete namespace_name, ids Delete documents by ID.
documents.delete_files namespace_name, file_names Delete uploaded files by filename.
vectors.upload namespace_name, vectors=[{id, vector}] Upload vectors to a vector namespace.
vectors.delete namespace_name, ids Delete vectors by ID.
similarity_search.query namespaces, query Run semantic search with text or vector queries.
answer.generate namespace, query Generate a grounded answer from a namespace.

For fully detailed method functionality, please see the API Reference.

🔗 Integrations

  • LlamaIndex: Use Moorcheh as a vector store inside LlamaIndex pipelines.
  • LangChain: Plug Moorcheh into LangChain retrievers and RAG chains.
  • n8n: Automate workflows that ingest, search, or answer with Moorcheh.
  • MCP: Connect Moorcheh to external tools via Model Context Protocol.

Roadmap (Planned)

Item Required Parameters Description
get_eigenvectors namespace_name, n_eigenvectors Expose top eigenvectors for semantic structure analysis.
get_graph namespace_name Provide a graph view of relationships across data in a namespace.
get_umap_image namespace_name, n_dimensions Generate a 2D UMAP projection image for quick visual exploration.

Documentation & Support

Have questions or feedback? We're here to help:

Contributing

Contributions are welcome! Please refer to the contributing guidelines (CONTRIBUTING.md) for details on setting up the development environment, running tests, and submitting pull requests.

License

This project is licensed under the MIT License - See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moorcheh_sdk-1.3.6.tar.gz (67.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moorcheh_sdk-1.3.6-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file moorcheh_sdk-1.3.6.tar.gz.

File metadata

  • Download URL: moorcheh_sdk-1.3.6.tar.gz
  • Upload date:
  • Size: 67.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for moorcheh_sdk-1.3.6.tar.gz
Algorithm Hash digest
SHA256 63af69dcc4d458e921acf60b538fb40500483f3274250f8ba7995d9a894810dd
MD5 6b5ae43ed4ca8f1649e7136ac635c20c
BLAKE2b-256 125ca258f3384ba5152dea08bbb3d1da48f28242b346e73a3a96c3bf015c635f

See more details on using hashes here.

File details

Details for the file moorcheh_sdk-1.3.6-py3-none-any.whl.

File metadata

  • Download URL: moorcheh_sdk-1.3.6-py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for moorcheh_sdk-1.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d9d649c8173d49043d091735b56fd10ca65fad7784870041e9ce4693ce11685f
MD5 4ad83aa5a3cce1c37202c88476aceb55
BLAKE2b-256 a929b51cc095d21369120e6b6ee1d416eff5198410d89a5b1cd79ea2be7bcf62

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page