Skip to main content

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.

Overview

Uploads one or more precomputed vectors to a vector namespace. Each vector length must match the namespace vector_dimension set at creation. The upload runs asynchronously. Poll upload_job_status with the returned job_id.
Any extra fields on each vector object (for example source, category) are stored as metadata and can be used in search filters.

Method

client.upload_namespace_vectors(namespace_name: str, payload: dict) -> dict

API

POST /namespaces/{namespace_name}/vectors — see Upload vectors

Parameters

namespace_name
string
required
Target vector namespace.
vectors
array
required
Non-empty array of vector objects.
vectors[].id
string
required
Item id, unique within this namespace.
vectors[].vector
array
required
Array of finite numbers. Length must equal the namespace vector_dimension.
vectors[].{metadata}
any
Optional additional keys on each vector are saved as metadata (for example "source": "demo").

Example

from moorcheh import MoorchehApiClient, MoorchehApiError

client = MoorchehApiClient("http://localhost:8080")

try:
    resp = client.upload_namespace_vectors("my-embeddings", {
        "vectors": [
            {
                "id": "vec-1",
                "vector": [0.1] * 768,
                "source": "demo",
            },
        ],
    })
    job_id = resp["job_id"]
except MoorchehApiError as e:
    if e.is_item_limit_exceeded:
        print(e.body)
    else:
        raise
Poll with upload_job_status.

Returns

status
string
"success" when the upload job was started.
message
string
Human-readable result description.
job_id
string
Id of the async upload job. Poll upload_job_status with this value.
namespace_name
string
Namespace the vectors are being uploaded to.
total
number
Number of vectors accepted into the upload job.
items
number
Current total item count on the instance. Present on 409 item limit errors in MoorchehApiError.body.
max_items
number
Global item cap for this instance. Present on 409 item limit errors.
requested_new
number
Number of new item ids in the request that would exceed the cap. Present on 409 item limit errors.
Example return value
{
  "status": "success",
  "message": "Vectors upload started. Poll job status for progress.",
  "job_id": "job-d044a3bf6c0e4380bf6ad7e9df7999d0",
  "namespace_name": "my-embeddings",
  "total": 1,
}

Errors

Non-2xx responses raise MoorchehApiError. Use e.is_item_limit_exceeded for 409 quota errors.
from moorcheh import MoorchehApiError

try:
    client.upload_namespace_vectors("my-embeddings", {"vectors": [...]})
except MoorchehApiError as e:
    print(e.status_code, e.body)
StatusCause
400Empty vectors, missing id/vector, non-finite values, dimension mismatch, or wrong namespace type
404Namespace not found
409Global item limit would be exceeded (job not started)
  • At most 100,000 items total across all namespaces
  • 409 is returned before the job starts if new ids would exceed the cap
  • Re-uploading an existing id in the same namespace updates the item and does not consume extra quota
  • Vector values must be finite (no NaN or Infinity)