article-tagger-sdk
v0.4.1
Published
TypeScript SDK for Article Tagger — RAG-based article tag generator
Maintainers
Readme
article-tagger-sdk
TypeScript SDK for Article Tagger — RAG-based article tag generator.
Install
npm install article-tagger-sdkUsage
import { ArticleTaggerClient } from "article-tagger-sdk";
const client = new ArticleTaggerClient({
baseUrl: "http://localhost:8000",
apiKey: "optional-api-key",
});
// Tag an article
const result = await client.tag("article text...", 5);
console.log(result.tags);
// [{ tag_name: "惡魔娘", score: 0.92, tag_id: "1", ... }, ...]
// Batch tag
const batch = await client.tagBatch(["article 1", "article 2"], 3);
// Feedback (drives active learning)
await client.addFeedback("article text", "tag_name", true);
await client.undoFeedback();
// Tag CRUD
await client.createTag({ name: "新標籤", description: "...", category: "分類" });
await client.updateTag("123", { description: "updated" });
await client.deleteTag("123");
const tags = await client.listTags("keyword");
// History
const history = await client.searchHistory("keyword");
await client.deleteHistory("456");
// Analytics & Quality
const analytics = await client.getAnalytics(30);
const quality = await client.getQuality();
// Co-occurrence suggestions
const suggestions = await client.suggestTags(["標籤A", "標籤B"]);
// Weights & Profiles
const weights = await client.getWeights();
const profiles = await client.listProfiles();
// Health
const health = await client.health();API
| Method | Description |
|--------|-------------|
| tag(text, topK?) | Tag single article |
| tagBatch(texts, topK?) | Batch tag |
| listTags(query?, limit?) | List/search tags |
| createTag(req) | Create tag |
| updateTag(id, req) | Update tag |
| deleteTag(id) | Delete tag |
| addFeedback(text, tag, correct) | Submit feedback |
| undoFeedback() | Undo last feedback |
| deleteFeedback(id) | Delete feedback |
| getFeedback(limit?, offset?) | Get feedback + stats |
| getHistory(limit?, offset?) | Get history |
| searchHistory(query, limit?) | Search history |
| deleteHistory(id) | Delete history |
| getAnalytics(days?) | Analytics dashboard |
| getQuality() | Quality report |
| getCooccurrence(limit?) | Co-occurrence pairs |
| suggestTags(tags, limit?) | Tag suggestions |
| getWeights() | Active Learning weights |
| listProfiles() | Config profiles |
| exportHistory(format?) | Export history |
| health() | Health check |
Requirements
Requires the Article Tagger API server running:
pip install article-tagger
article-tagger build-index --tags tags.json
article-tagger serveLicense
MIT
