SDK developer guide

This document covers the developer-facing SDKs for calling the RAG platform and the LMS / HR / Knowledge APIs from external applications. You'll find C#, JavaScript, and Python client implementations, auth flow, and how to call the vector / search / learning-data APIs.


1. Overview

The SDK is a wrapper that makes the following easy:

  • OAuth2 / API-key authentication
  • Document upload and chunking
  • Vector generation and search
  • RAG query (search + response generation)
  • LMS / user learning-data fetch
  • Webhook verification

Currently offered in:

  • C# / .NET 7+
  • JavaScript / TypeScript
  • Python (3.10+)

2. Authentication

Two options:

  1. API key (easiest)
  2. OAuth2 Client Credentials (enterprise)
■ API-key usage examples
C# (.NET)
var client = new RagClient("YOUR_API_KEY");
var result = await client.SearchAsync("請求書の書き方について教えて");
JavaScript
import { RagClient } from "@lms/sdk";

const client = new RagClient({ apiKey: "YOUR_API_KEY" });

const result = await client.search("AI 活用方法とは?");
Python
from lms_sdk import RagClient

client = RagClient(api_key="YOUR_API_KEY")
result = client.search("社内 Wiki の更新方法を教えて")

3. RAG search

■ C# / .NET
var response = await client.RagQueryAsync(new RagQueryRequest
{
    Query = "決裁フローの最新ルールを教えて",
    TopK = 5,
    Filter = new { department = "管理部" }
});
■ JavaScript
const response = await client.ragQuery({
  query: "社内の AI 利用ポリシーを要約して",
  topK: 5
});
■ Python
response = client.rag_query(
    query="営業部の成功事例を教えて",
    top_k=5
)

4. Vector operations

■ Upsert
await client.Vectors.UpsertAsync(new VectorUpsertRequest {
    Id = "chunk-001",
    Values = embedding,
    Metadata = new {
        text = "AIとは…",
        source = "wiki",
        category = "tech"
    }
});
■ Search
var results = await client.Vectors.SearchAsync(new VectorSearchRequest {
    Vector = queryEmbedding,
    TopK = 5
});

5. Document upload

Bulk-load PDF / Word / Markdown, auto-chunk, and register into the store.

■ C#
await client.Documents.UploadAsync(new DocumentUploadRequest {
    FileName = "規程集.pdf",
    Content = fileBytes,
    SplitBy = "auto"
});

6. Webhook verification

var ok = WebhookVerifier.Verify(signature, body, secret);

Webhooks are used for RAG updates, course generation, learning-progress notifications, etc.


7. Error handling

The SDK returns API and network errors in a unified format.

try {
    var r = await client.SearchAsync("テスト");
}
catch (ApiException ex) {
    Console.WriteLine(ex.StatusCode);
    Console.WriteLine(ex.Error.Detail);
}

Next: API reference →