The problem: You have 5,000 documents from discovery. Finding the relevant ones takes weeks of manual review.
The solution: Upload to a Vault. We OCR, chunk, and index everything. Search by meaning in seconds.
1. Create a vault
Vaults are secure containers for your users’ documents. Each vault gets automatic OCR, chunking, and vector indexing.
import Casedev from 'casedev';
const client = new Casedev({ apiKey: process.env.CASEDEV_API_KEY });
// Create a vault for your user's documents
const vault = await client.vault.create({
name: 'Case Documents - User 12345',
description: 'Discovery documents for case review'
});
console.log(`Vault created: ${vault.id}`);
2. Upload documents
Handle file uploads from your users and trigger automatic processing:
import fs from 'fs';
async function uploadDocument(vaultId: string, filePath: string) {
// Get presigned upload URL
const upload = await client.vault.upload(vaultId, {
filename: filePath.split('/').pop()!,
contentType: 'application/pdf'
});
// Upload file to S3
const file = fs.readFileSync(filePath);
await fetch(upload.uploadUrl, {
method: 'PUT',
headers: { 'Content-Type': 'application/pdf' },
body: file
});
// Trigger OCR + embedding pipeline
await client.vault.ingest(vaultId, upload.objectId);
return upload.objectId;
}
// Process uploads from your user
const files = fs.readdirSync('./uploads');
for (const file of files) {
await uploadDocument(vault.id, `./uploads/${file}`);
console.log(`Processed: ${file}`);
}
3. Search by meaning
Enable your users to search by meaning, not just keywords:
// In your search endpoint or UI handler
const results = await client.vault.search(vault.id, {
query: userQuery, // e.g., "communications about equipment failure"
method: 'hybrid',
topK: 10
});
// Return results to your user
for (const chunk of results.chunks) {
console.log(`📄 ${chunk.filename} (score: ${chunk.hybridScore.toFixed(2)})`);
console.log(`"${chunk.text.substring(0, 200)}..."`);
}
4. Summarize findings
Enhance results with AI-generated summaries for your users:
const context = results.chunks.map(c => c.text).join('\n\n---\n\n');
const summary = await client.llm.v1.chat.createCompletion({
model: 'anthropic/claude-sonnet-4.5',
messages: [
{
role: 'system',
content: 'Summarize these search results concisely. Highlight the most relevant findings.'
},
{
role: 'user',
content: `User searched for: "${userQuery}"\n\nResults:\n\n${context}`
}
],
max_tokens: 500
});
// Return summary along with search results
console.log(summary.choices[0].message.content);
Time saved: What used to take weeks of manual review now takes minutes. The AI finds relevant passages even when documents use different terminology.