API Reference
Ingest Documents
Build a knowledge graph from documents in one or more vaults.
Endpoint
Concept
Provide one or more vault IDs, and we'll extract entities and relationships from all documents to build an interconnected knowledge graph. You can create vault-specific graphs or combine multiple vaults into a unified graph for cross-case analysis.
Use Cases
Single-Vault Graph:
- Build a graph for one case's documents
- All depositions, medical records, and evidence in one vault
- Graph shows relationships within the case
Multi-Vault Graph:
- Combine documents from multiple vaults
- Cross-case pattern analysis
- Find connections across related matters
What Gets Extracted
Entities:
- People (witnesses, parties, attorneys, experts)
- Organizations (companies, hospitals, government agencies)
- Locations (addresses, cities, accident sites)
- Dates and times (key events, timelines)
- Medical terms (diagnoses, procedures, medications)
- Legal concepts (statutes, claims, defenses)
Relationships:
- Employment (worked for, employed by)
- Testimony (testified about, stated that)
- Medical (treated, diagnosed, prescribed)
- Temporal (occurred before, happened after)
- Causal (caused by, resulted in)
- Legal (sued, represented, filed against)
Communities:
- Thematic clusters of related entities
- Example: "COVID Research Community" with Fauci, Daszak, Wuhan Institute, EcoHealth
- Hierarchical organization for multi-level analysis
Search Knowledge Graph
Query the knowledge graph using natural language questions.
Endpoint
Request Body
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Your question in natural language |
method | string | Yes | Search method: fast, global, local, graph, or hybrid |
topK | number | No | Number of results to return (default: 10) |
Search Methods
Fast Search (method: "fast") ⚡ Recommended
Instant semantic search using S3 Vectors - no GraphRAG needed!
Perfect for:
- Any search query on vault documents
- Real-time applications and chatbots
- Works immediately after document upload
- Quick factual lookups
Returns (in < 500ms):
How it works: Semantic embedding similarity using OpenAI text-embedding-3-small and S3 Vectors for sub-second searches.
Response time: < 500ms
Hybrid Search (method: "hybrid") 🎯 Best Accuracy
Combines semantic similarity (70%) with keyword matching (30%)
Perfect for:
- When you need both meaning AND exact keywords
- Legal searches where specific terms matter
- Best overall accuracy for most queries
Returns (in < 1 second):
How it works: Gets vector candidates from S3, scores with BM25, normalizes and fuses both scores.
Response time: < 1 second
Entity Search (method: "entity")
GraphRAG entity-based search - requires GraphRAG indexing
Perfect for:
- "Who are the medical practitioners?" (entity names)
- "List all facilities" (entity extraction)
- After you've run GraphRAG indexing
Returns (in ~2-3 seconds):
How it works: Searches GraphRAG's extracted entities using keyword matching.
Response time: ~2-3 seconds Setup required: POST /vault/:id/graphrag/init
Global Search (method: "global")
Perfect for:
- "What are the main themes in this case?"
- "Summarize all medical treatments provided"
- "What patterns emerge across depositions?"
Returns (in ~15-20 seconds):
How it works: Analyzes community summaries and high-level patterns across the entire knowledge graph for comprehensive analysis.
Response time: ~15-20 seconds
Local Search (method: "local")
Perfect for:
- "Who is connected to Dr. Smith?"
- "What medications were prescribed?"
- "Tell me about Salem Health"
Returns:
How it works: Focuses on specific entities and their immediate relationships in the graph.
Graph Search (method: "graph")
Perfect for:
- Finding all documents related to a specific entity
- Discovering connections between entities
- Relationship-based queries
Returns:
How it works: Traverses entity relationships to find connections.
Hybrid Search (method: "hybrid")
Combines entity matching with graph traversal for comprehensive results.
Query Examples
Source Attribution
Every response includes references to source documents, so you can verify and cite specific passages.
Get Graph Statistics
Get statistics about your vault's knowledge graph.
Endpoint
Response
Fields
| Field | Type | Description |
|---|---|---|
entity_count | number | Total entities extracted from documents |
relationship_count | number | Total relationships mapped between entities |
community_count | number | Number of thematic communities detected |
document_count | number | Number of documents indexed in the graph |
Example
Graph Storage
Per-Vault Graphs
Each vault can have its own knowledge graph, stored alongside documents and vectors.
Cross-Vault Graphs
Combine multiple vaults into unified graphs for:
- Multi-matter pattern analysis
- Firm-wide knowledge bases
- Related case analysis
Scalability
- Graphs scale to millions of entities and relationships
- Sub-second query performance
- Incremental updates as new documents are added