Skip to content

Latest commit

 

History

History
74 lines (63 loc) · 2 KB

File metadata and controls

74 lines (63 loc) · 2 KB
title create_folder
description Create a new folder for organizing documents
```python def create_folder( name: str, description: Optional[str] = None, full_path: Optional[str] = None, parent_id: Optional[str] = None, ) -> Folder ``` ```python async def create_folder( name: str, description: Optional[str] = None, full_path: Optional[str] = None, parent_id: Optional[str] = None, ) -> Folder ```

Parameters

  • name (str): Folder name (leaf segment when using nested paths). If full_path is omitted, this becomes the canonical path.
  • description (str, optional): Optional description of the folder.
  • full_path (str, optional): Canonical folder path (e.g., "/projects/alpha/specs"). Leading slash is optional; parents are created automatically.
  • parent_id (str, optional): Explicit parent folder ID. Usually not needed—full_path handles hierarchy creation.

Returns

  • Folder: Newly created folder object.

Examples

```python from morphik import Morphik
db = Morphik()
folder = db.create_folder("marketing_docs", description="All marketing collateral")

# Create a nested folder (parents auto-created)
nested = db.create_folder(
    name="specs",
    full_path="/projects/alpha/specs",
    description="All project specs",
)
print(nested.full_path)  # "/projects/alpha/specs"
```
```python from morphik import AsyncMorphik
async with AsyncMorphik() as db:
    folder = await db.create_folder("marketing_docs", description="All marketing collateral")

    nested = await db.create_folder(
        name="specs",
        full_path="/projects/alpha/specs",
        description="All project specs",
    )
    print(nested.full_path)  # "/projects/alpha/specs"
```