Skip to main content

namespaces.create

Creates a new namespace for storing text documents or precomputed vector embeddings on your on-prem Moorcheh instance.
The * in the signature means everything after it is keyword-only. You must pass type and vector_dimension by name — for example type="text" — not as extra positional arguments.
API: POST /namespaces — see Create namespace

Parameters

str
required
A unique name for the namespace. Alphanumeric characters, hyphens, and underscores only.
str
required
The type of namespace: "text" or "vector".
Optional[int]
The dimension of vectors. Required when type is "vector". Must be greater than 0. Do not pass for text namespaces.
Returns: dict[str, Any] — confirmation with status, message, namespace_name, type, and vector_dimension. Raises: MoorchehApiError — HTTP 400 for invalid input, 409 when the namespace already exists.

Examples

Create Text Namespace
Create Vector Namespace

Error Handling

On-prem uses a single exception type. Check e.status_code and e.body for details.
Error Handling Example
Example return value (text)

Namespace Types

Best Practices

  • Use descriptive namespace names that indicate their purpose
  • Separate different content types into different namespaces
  • Plan your data layout before creating namespaces — type cannot be changed after creation
  • Prefer text namespaces for most workflows; use vector namespaces only when you supply your own embeddings
  • Match vector_dimension to your embedding model (for example 768 or 1536)