Skip to main content

Document Workflow

This workflow demonstrates how to work with documents using the Nestbox AI CLI. It covers listing collections, creating a new one with metadata, uploading structured content and files, and running semantic search.

Step 1: List Collections

Check what collections already exist for your project and instance:

nestbox document collection list --project myProject123 --instance myInstance456

Step 2: Create Collection

Create a new document collection with a name, description, and metadata:

nestbox document collection create --project myProject123 --instance myInstance456 --name "Marketing Documents" --description "Collection for storing all marketing materials." --metadata '{"department": "Marketing", "type": "documents"}'

Step 3: Add Documents

Add a structured document directly with JSON data:

nestbox document doc add --project myProject123 --instance myInstance456 --collection marketingDocsCollection --data '{"title": "Q1 Marketing Strategy", "content": "This document outlines the marketing strategy for Q1."}'

Upload a file to the same collection:

nestbox document doc upload-file --project myProject123 --instance myInstance456 --collection marketingDocsCollection --file "/path/to/marketing_report.pdf"

Search the collection semantically using a query and an optional filter:

nestbox document search --project myProject123 --instance myInstance456 --collection marketingDocsCollection --query "Marketing Strategy" --topK 3 --filter '{"department": "Marketing"}'