SentientKG
Introduction
Troubleshooting
Documentation

SentientKG Platform Documentation

Welcome to the comprehensive documentation for SentientKG's GraphRAG platform. This guide will help you integrate our advanced knowledge graph and retrieval-augmented generation capabilities into your applications.

API Version

Current API version is v2.1. All endpoints are backward compatible with v2.0.

Getting Started

Setup

To begin using SentientKG, you'll need to obtain an API key from your dashboard and configure your environment.

Environment Configuration
# .env file
SENTIENTKG_API_KEY=your_api_key_here
SENTIENTKG_BASE_URL=https://api.sentientkg.com/v2

Authentication

All API requests require authentication using your API key in the Authorization header.

Authentication Example
const response = await fetch('https://api.sentientkg.com/v2/query/graphrag', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer your_api_key_here',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    query: "What are the key trends in renewable energy?"
  })
});

First API Call

Let's make your first GraphRAG query to understand how the platform works.

Simple GraphRAG Query
import { SentientKG } from '@sentientkg/sdk';

const client = new SentientKG({
  apiKey: process.env.SENTIENTKG_API_KEY
});

async function queryKnowledgeGraph() {
  try {
    const result = await client.query({
      text: "Analyze the relationship between market volatility and regulatory changes",
      includeReasoningPath: true,
      maxHops: 3
    });
    
    console.log('Answer:', result.answer);
    console.log('Reasoning Path:', result.reasoningPath);
    console.log('Source Entities:', result.sourceEntities);
  } catch (error) {
    console.error('Query failed:', error);
  }
}

Core Concepts

GraphRAG Overview

Graph Retrieval-Augmented Generation (GraphRAG) combines the structured reasoning capabilities of knowledge graphs with the natural language understanding of large language models.

Multi-hop Reasoning

Navigate complex relationships across multiple entities to uncover deep insights.

Contextual Understanding

Leverage semantic relationships for more accurate and relevant responses.

Knowledge Graphs

Knowledge graphs in SentientKG represent information as interconnected entities and relationships, enabling sophisticated reasoning about complex domains.

Knowledge Graph Structure
{
  "entities": [
    {
      "id": "entity_123",
      "type": "Company",
      "properties": {
        "name": "TechCorp Inc.",
        "industry": "Technology",
        "founded": "2010"
      }
    }
  ],
  "relationships": [
    {
      "source": "entity_123",
      "target": "entity_456",
      "type": "ACQUIRED",
      "properties": {
        "date": "2023-01-15",
        "amount": "$2.5B"
      }
    }
  ]
}

API Reference

Data Ingestion

The ingestion endpoint allows you to add new data sources to your knowledge graph.

POST /v2/ingest
{
  "source": {
    "type": "document",
    "content": "Your document content here...",
    "metadata": {
      "title": "Market Analysis Report",
      "author": "Jane Smith",
      "date": "2024-01-15"
    }
  },
  "options": {
    "extractEntities": true,
    "buildRelationships": true,
    "chunkingStrategy": "semantic"
  }
}

GraphRAG Query

Execute sophisticated queries against your knowledge graph with natural language.

POST /v2/query/graphrag
{
  "query": "What are the emerging trends in sustainable technology?",
  "options": {
    "maxHops": 3,
    "includeReasoningPath": true,
    "confidenceThreshold": 0.8,
    "responseFormat": "detailed"
  }
}

Troubleshooting

Rate Limiting

API requests are limited to 1000 requests per hour for standard plans.

Authentication Errors

Ensure your API key is valid and included in the Authorization header.