What are Namespaces?
Namespaces are isolated containers for storing and organizing your data in Moorcheh. They provide separate environments for your documents or vectors, ensuring data separation and enabling organized data management.
Each namespace can store either text documents or vector embeddings, but not both. Choose the type based on your use case.
Namespace Types
Text Namespaces
Vector Namespaces
Text Namespaces
Text namespaces automatically handle embedding generation. Simply upload your text, and Moorcheh takes care of the vectorization.Best for:
- Document search
- Knowledge bases
- Content management
- File uploads (PDF, DOCX, etc.)
Example:# Create text namespace
client.create_namespace(
namespace_name="my-documents",
type="text"
)
Vector Namespaces
Vector namespaces store pre-computed embeddings, giving you full control over the embedding model and process.Best for:
- Custom embedding models
- Pre-existing embeddings
- Advanced use cases
Example:# Create vector namespace
client.create_namespace(
namespace_name="my-vectors",
type="vector",
vector_dimension=1536 # Must match your embeddings
)
Creating a Namespace
from moorcheh_sdk import MoorchehClient
client = MoorchehClient(api_key="your-api-key")
# Text namespace
namespace = client.create_namespace(
namespace_name="my-documents",
type="text"
)
# Vector namespace with specific dimension
namespace = client.create_namespace(
namespace_name="my-vectors",
type="vector",
vector_dimension=1536
)
Listing Namespaces
# Get all namespaces
namespaces = client.list_namespaces()
for ns in namespaces:
print(f"Name: {ns['namespace_name']}")
print(f"Type: {ns['type']}")
print(f"Items: {ns['item_count']}")
Deleting a Namespace
Deleting a namespace is permanent and cannot be undone. All data in the namespace will be lost.
# Delete namespace
client.delete_namespace(namespace_name="my-documents")
Naming Guidelines
product-docs
customer_support_v2
legal-contracts-2024
blog_embeddings
- Special characters (except
- and _)
- Spaces
- Very long names (> 64 characters)
Next Steps