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.POST /namespaces — see Create namespace
Parameters
A unique name for the namespace. Alphanumeric characters, hyphens, and underscores only.
The type of namespace:
"text" or "vector".The dimension of vectors. Required when
type is "vector". Must be greater than 0. Do not pass for text namespaces.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. Checke.status_code and e.body for details.
Error Handling Example
| Status | Cause |
|---|---|
| 400 | Invalid name, missing vector_dimension for vector type, or vector_dimension sent for text type |
| 409 | Namespace already exists |
Example return value (text)
Namespace Types
| Feature | Text Namespaces | Vector Namespaces |
|---|---|---|
| Primary use | Storing and searching text documents | Storing pre-computed vector embeddings |
| Embeddings | Generated on upload by your configured provider (Ollama, OpenAI, or Cohere) | Provided by you |
| Requirements | Embedding provider configured via moorcheh configure | Must specify vector_dimension at creation |
| Search | Text query → embedded → similarity search | Vector query → similarity search |
| Ideal for | FAQs, documentation, articles | Custom ML models, image embeddings |
Best Practices
- Use descriptive namespace names that indicate their purpose
- Separate different content types into different namespaces
- Plan your data layout before creating namespaces —
typecannot be changed after creation - Prefer text namespaces for most workflows; use vector namespaces only when you supply your own embeddings
- Match
vector_dimensionto your embedding model (for example768or1536)
Related Operations
- List Namespaces — view all namespaces
- Delete Namespace — remove a namespace
- API: Create namespace
- CLI: moorcheh namespace-create