Knowledge Graphs

Graph-based knowledge retrieval - Build semantic knowledge graphs from your documents.

Build semantic knowledge graphs from your documents. Connect concepts, entities, and relationships for deeper insights and natural language search.

What is GraphRAG?

GraphRAG combines the power of knowledge graphs with retrieval-augmented generation (RAG). Instead of just searching text, you can ask questions in plain English and get answers based on a graph of connected entities, relationships, and communities.

Key Benefits:

  • Natural language search - Ask questions like "What medical facilities treated the patient?"
  • Entity extraction - Automatically identify people, organizations, dates, locations
  • Relationship mapping - Discover connections between entities across documents
  • Community detection - Find thematic clusters and high-level patterns

Authentication

Authorization: Bearer sk_case_your_api_key_here

Quick Start

1. Create a Vault with GraphRAG Enabled

curl -X POST https://api.case.dev/vault \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Medical Records",
    "description": "Patient medical records with GraphRAG search",
    "enableGraph": true
  }'

2. Upload Documents

curl -X POST https://api.case.dev/vault/{vault_id}/upload \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "filename": "medical-record.pdf",
    "contentType": "application/pdf"
  }'

3. Trigger OCR and GraphRAG Indexing

curl -X POST https://api.case.dev/vault/{vault_id}/ingest/{object_id} \
  -H "Authorization: Bearer sk_case_your_api_key_here"

4. Search with Natural Language

# Fast search - quick entity lookups (2-3 seconds)
curl -X POST https://api.case.dev/vault/{vault_id}/search \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What medical treatments did the patient receive?",
    "method": "fast",
    "topK": 5
  }'

# Global search - holistic questions across all documents (15-20 seconds)
curl -X POST https://api.case.dev/vault/{vault_id}/search \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What are the main medical facilities mentioned in these records?",
    "method": "global"
  }'

# Local search - entity-specific questions
curl -X POST https://api.case.dev/vault/{vault_id}/search \
  -H "Authorization: Bearer sk_case_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "Tell me about treatments provided by Salem Health",
    "method": "local"
  }'

Search Methods

Fast Search (method: "fast") ⚡

Best for quick factual lookups and entity identification. Returns results in 2-3 seconds.

Use cases:

  • "Who are the medical practitioners mentioned?"
  • "What treatments were provided?"
  • "List all medical facilities"
  • Quick preliminary searches before deeper analysis

How it works: Directly searches GraphRAG's extracted entities using keyword matching on entity names and descriptions. Fast and efficient for factual queries.

Response time: ~2-3 seconds

Global Search (method: "global")

Best for holistic questions across your entire document corpus. Returns results in 15-20 seconds.

Use cases:

  • "What are the main themes in these documents?"
  • "Summarize all medical treatments provided"
  • "What are the implications of the treatment decisions?"

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")

Best for questions about specific entities or detailed information.

Use cases:

  • "Tell me about Salem Health Medical Center"
  • "What medications were prescribed?"
  • "Who provided physical therapy services?"

How it works: Focuses on specific entities and their immediate relationships in the graph.

Graph Search (method: "graph")

Traverses entity relationships to find connections.

Use cases:

  • Finding all documents related to a specific provider
  • Discovering connections between entities
  • Relationship-based queries

Hybrid Search (method: "hybrid")

Combines entity matching with graph traversal for the best of both worlds.

What's Next?