Overview
Folders in Morphik provide a way to organize documents into logical groups. This is particularly useful for multi-project environments where you want to maintain separation between different contexts. Documents within a folder are isolated from those in other folders, allowing for clean organization and data separation.Creating and Accessing Folders
- Sync
- Async
Operations Within a Folder
Once you have a folder object, all operations performed on it are scoped to that folder. Documents created, retrieved, or manipulated will be contained within this folder’s scope.- Sync
- Async
Folder Methods
All the core document operations available on the main Morphik client are also available on folder objects, but they are automatically scoped to the specific folder:ingest_text
- Ingest text content into this folderingest_file
- Ingest a file into this folderingest_files
- Ingest multiple files into this folderingest_directory
- Ingest all files from a directory into this folderretrieve_chunks
- Retrieve chunks matching a query from this folderretrieve_docs
- Retrieve documents matching a query from this folderquery
- Generate a completion using context from this folder (supportsllm_config
parameter for custom LLM configuration)list_documents
- List all documents in this folderbatch_get_documents
- Get multiple documents by their IDs from this folderbatch_get_chunks
- Get specific chunks by source from this foldercreate_graph
- Create a knowledge graph from documents in this folderupdate_graph
- Update a knowledge graph with new documents from this folderdelete_document_by_filename
- Delete a document by filename from this folder
Using Custom LLM Configuration with Folders
You can pass a custom LLM configuration when querying within a folder:- Sync
- Async
Example: Project Document Management
A common use case for folders is separating different projects. Here’s an example of how to organize project documentation:- Sync
- Async
Accessing a Folder’s User Scope
You can further scope operations within a folder to a specific user by using thesignin
method on the folder object:
- Sync
- Async