Documentation Index
Fetch the complete documentation index at: https://docs.moorcheh.ai/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
pip install moorcheh-client
moorcheh up
Confirm the server is running:
from moorcheh import MoorchehApiClient
client = MoorchehApiClient("http://localhost:8080")
health = client.health()
assert health["status"] == "ok"
See health() for quota fields.
Full example — text namespace
This example creates a text namespace, uploads a document, polls the async upload job, and runs a semantic search.
import time
from moorcheh import MoorchehApiClient, MoorchehApiError
client = MoorchehApiClient("http://localhost:8080")
# 1. Check quota
health = client.health()
print(f"Items: {health['items']} / {health['max_items']}")
# 2. Create a text namespace
try:
client.create_namespace({
"namespace_name": "docs",
"type": "text",
})
except MoorchehApiError as e:
if e.status_code != 409: # 409 = namespace already exists
raise
# 3. Upload documents (async job)
resp = client.upload_namespace_documents("docs", {
"documents": [
{"id": "doc-1", "text": "Hello Moorcheh", "team": "ai"},
],
})
# 4. Poll until upload completes
job_id = resp["job_id"]
while True:
job = client.upload_job_status("docs", job_id)
if job["status"] == "completed":
if job["failed"]:
print("Upload errors:", job.get("last_error"))
break
time.sleep(0.5)
# 5. Search
hits = client.search({
"query": "hello moorcheh",
"namespaces": ["docs"],
"top_k": 5,
"metadata": {"team": "ai"},
})
for r in hits["results"]:
print(r["id"], r["score"], r["label"], r.get("text"))
Vector namespace (optional)
For precomputed embeddings, create a vector namespace and upload vectors instead:
client.create_namespace({
"namespace_name": "embeddings",
"type": "vector",
"vector_dimension": 768,
})
resp = client.upload_namespace_vectors("embeddings", {
"vectors": [
{"id": "vec-1", "vector": [0.1] * 768, "source": "demo"},
],
})
# Poll upload job, then search with a vector query
hits = client.search({
"query": [0.1] * 768,
"namespaces": ["embeddings"],
"top_k": 5,
})
See upload_namespace_vectors() and search().
CLI equivalent
moorcheh status
moorcheh namespace-create --name docs --type text
moorcheh upload-documents --namespace-name docs --documents-file docs.json
moorcheh upload-job-status --namespace-name docs --job-id <job_id>
moorcheh search --query "hello moorcheh" --namespaces docs --top-k 5
docs.json:
{
"documents": [
{"id": "doc-1", "text": "Hello Moorcheh", "team": "ai"}
]
}
Method reference
| Step | Python method | Docs |
|---|
| Health / quota | client.health() | health |
| Create namespace | client.create_namespace(...) | create_namespace |
| Upload documents | client.upload_namespace_documents(...) | upload_namespace_documents |
| Poll upload | client.upload_job_status(...) | upload_job_status |
| Search | client.search(...) | search |
Tips
- Text upload and text search require Ollama running (started by
moorcheh up)
- Global item cap is 100,000 across all namespaces — check
health() or handle 409 on upload
- Upload and namespace delete are async — always poll the job until
status is "completed"
- Item ids are unique per namespace, not globally
Next steps