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
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.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
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 —
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