@thinkhive/sdk 4.1.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +161 -2
- package/dist/api/documents.d.ts +52 -0
- package/dist/api/documents.js +58 -0
- package/dist/api/drift.d.ts +70 -0
- package/dist/api/drift.js +71 -0
- package/dist/api/eval-runs.d.ts +126 -0
- package/dist/api/eval-runs.js +126 -0
- package/dist/api/llm-costs.d.ts +104 -0
- package/dist/api/llm-costs.js +81 -0
- package/dist/api/notifications.d.ts +103 -0
- package/dist/api/notifications.js +110 -0
- package/dist/api/sessions.d.ts +57 -0
- package/dist/api/sessions.js +49 -0
- package/dist/api/shadow-tests.d.ts +78 -0
- package/dist/api/shadow-tests.js +80 -0
- package/dist/api/signals.d.ts +177 -0
- package/dist/api/signals.js +172 -0
- package/dist/core/client.d.ts +2 -0
- package/dist/core/client.js +10 -4
- package/dist/guardrails.d.ts +70 -0
- package/dist/guardrails.js +34 -0
- package/dist/index.d.ts +105 -2
- package/dist/index.js +50 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# ThinkHive SDK v4.
|
|
1
|
+
# ThinkHive SDK v4.2.0
|
|
2
2
|
|
|
3
3
|
The official JavaScript/TypeScript SDK for [ThinkHive](https://thinkhive.ai) - AI Agent Observability Platform.
|
|
4
4
|
|
|
@@ -73,6 +73,19 @@ await shutdown();
|
|
|
73
73
|
| `conversationEval` | Multi-turn conversation grading |
|
|
74
74
|
| `transcriptPatterns` | Pattern detection in transcripts |
|
|
75
75
|
|
|
76
|
+
### Operations & Monitoring APIs
|
|
77
|
+
|
|
78
|
+
| API | Description |
|
|
79
|
+
|-----|-------------|
|
|
80
|
+
| `evalRuns` | Create, manage, and query evaluation runs |
|
|
81
|
+
| `signals` | Behavioral signal configuration, stats, and trends |
|
|
82
|
+
| `notifications` | Alert rules and notification management |
|
|
83
|
+
| `documents` | Agent RAG document upload and management |
|
|
84
|
+
| `shadowTests` | Shadow test creation and execution |
|
|
85
|
+
| `sessions` | Trace session grouping and querying |
|
|
86
|
+
| `drift` | Model/behavior drift detection |
|
|
87
|
+
| `llmCosts` | LLM usage cost tracking and optimization |
|
|
88
|
+
|
|
76
89
|
### Legacy APIs (V2)
|
|
77
90
|
|
|
78
91
|
| API | Description |
|
|
@@ -520,7 +533,153 @@ import { customerContext, captureCustomerContext } from '@thinkhive/sdk/integrat
|
|
|
520
533
|
| `THINKHIVE_SERVICE_NAME` | Service name for traces (optional) |
|
|
521
534
|
| `THINKHIVE_AGENT_ID` | Default agent ID (optional) |
|
|
522
535
|
|
|
523
|
-
##
|
|
536
|
+
## Eval Runs
|
|
537
|
+
|
|
538
|
+
```typescript
|
|
539
|
+
import { evalRuns } from '@thinkhive/sdk';
|
|
540
|
+
|
|
541
|
+
// Create an evaluation run
|
|
542
|
+
const run = await evalRuns.create('agent-123', { confidenceLevel: 'medium' });
|
|
543
|
+
|
|
544
|
+
// Get results
|
|
545
|
+
const results = await evalRuns.getResults(run.id, { limit: 50 });
|
|
546
|
+
|
|
547
|
+
// Estimate cost before running
|
|
548
|
+
const cost = await evalRuns.estimateCost('agent-123', { confidenceLevel: 'high' });
|
|
549
|
+
|
|
550
|
+
// List recent runs
|
|
551
|
+
const runs = await evalRuns.list({ agentId: 'agent-123', limit: 10 });
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
## Signals
|
|
555
|
+
|
|
556
|
+
```typescript
|
|
557
|
+
import { signals } from '@thinkhive/sdk';
|
|
558
|
+
|
|
559
|
+
// List all signals
|
|
560
|
+
const allSignals = await signals.list();
|
|
561
|
+
|
|
562
|
+
// Create a custom behavioral signal
|
|
563
|
+
await signals.create('Escalation Request', 'negative', {
|
|
564
|
+
type: 'keywords',
|
|
565
|
+
keywords: ['speak to manager', 'escalate'],
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
// Get signal stats and trends
|
|
569
|
+
const stats = await signals.getStats({ agentId: 'agent-123' });
|
|
570
|
+
const trends = await signals.getTrends({ granularity: 'daily' });
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
## Notifications
|
|
574
|
+
|
|
575
|
+
```typescript
|
|
576
|
+
import { notifications } from '@thinkhive/sdk';
|
|
577
|
+
|
|
578
|
+
// Create an alert rule
|
|
579
|
+
await notifications.createRule({
|
|
580
|
+
agentId: 'agent-123',
|
|
581
|
+
name: 'High failure rate alert',
|
|
582
|
+
eventType: 'failure_spike',
|
|
583
|
+
condition: { threshold: 0.3 },
|
|
584
|
+
channel: 'email',
|
|
585
|
+
target: 'team@company.com',
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
// List notifications
|
|
589
|
+
const alerts = await notifications.listNotifications('agent-123', true);
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
## Documents (RAG)
|
|
593
|
+
|
|
594
|
+
```typescript
|
|
595
|
+
import { documents } from '@thinkhive/sdk';
|
|
596
|
+
|
|
597
|
+
// Upload a document
|
|
598
|
+
await documents.upload('agent-123', 'faq.txt', 'text/plain', 1024);
|
|
599
|
+
|
|
600
|
+
// List agent documents
|
|
601
|
+
const docs = await documents.list('agent-123');
|
|
602
|
+
|
|
603
|
+
// Delete a document
|
|
604
|
+
await documents.remove('agent-123', 'doc-456');
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
## Shadow Tests
|
|
608
|
+
|
|
609
|
+
```typescript
|
|
610
|
+
import { shadowTests } from '@thinkhive/sdk';
|
|
611
|
+
|
|
612
|
+
// Create a shadow test
|
|
613
|
+
await shadowTests.create({
|
|
614
|
+
fixId: 'fix-456',
|
|
615
|
+
agentId: 'agent-123',
|
|
616
|
+
testName: 'Refund policy test',
|
|
617
|
+
inputData: { message: 'How do I get a refund?' },
|
|
618
|
+
expectedOutput: 'You can request a refund within 30 days.',
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
// List tests for an agent
|
|
622
|
+
const tests = await shadowTests.list('agent-123');
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
## Sessions
|
|
626
|
+
|
|
627
|
+
```typescript
|
|
628
|
+
import { sessions } from '@thinkhive/sdk';
|
|
629
|
+
|
|
630
|
+
// List conversation sessions
|
|
631
|
+
const allSessions = await sessions.list('agent-123', { limit: 20 });
|
|
632
|
+
|
|
633
|
+
// Get all traces in a session
|
|
634
|
+
const traces = await sessions.getTraces('session-789', 'agent-123');
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
## Drift Detection
|
|
638
|
+
|
|
639
|
+
```typescript
|
|
640
|
+
import { drift, hasDrift, getDriftSeverity } from '@thinkhive/sdk';
|
|
641
|
+
|
|
642
|
+
// Detect drift for an agent
|
|
643
|
+
const report = await drift.detect('agent-123');
|
|
644
|
+
if (hasDrift(report)) {
|
|
645
|
+
console.log(`Drift severity: ${getDriftSeverity(report)}`);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
// Detect drift across all agents
|
|
649
|
+
const allDrift = await drift.detectAll();
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
## LLM Costs
|
|
653
|
+
|
|
654
|
+
```typescript
|
|
655
|
+
import { llmCosts, formatCost } from '@thinkhive/sdk';
|
|
656
|
+
|
|
657
|
+
// Get cost summary
|
|
658
|
+
const summary = await llmCosts.getSummary({ period: '30d' });
|
|
659
|
+
console.log(`Total cost: ${formatCost(summary.totalCost)}`);
|
|
660
|
+
|
|
661
|
+
// Get per-agent breakdown
|
|
662
|
+
const breakdown = await llmCosts.getBreakdown('agent-123');
|
|
663
|
+
|
|
664
|
+
// Get optimization savings
|
|
665
|
+
const savings = await llmCosts.getSavings();
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
## Upgrading
|
|
669
|
+
|
|
670
|
+
### v4.1.0 → v4.2.0
|
|
671
|
+
|
|
672
|
+
New in v4.2.0:
|
|
673
|
+
- **`evalRuns`** — create, list, and manage evaluation runs programmatically
|
|
674
|
+
- **`signals`** — behavioral signal CRUD with stats and trends
|
|
675
|
+
- **`notifications`** — alert rule configuration and notification management
|
|
676
|
+
- **`documents`** — agent RAG document upload/list/delete
|
|
677
|
+
- **`shadowTests`** — shadow test creation and management
|
|
678
|
+
- **`sessions`** — trace session grouping and querying
|
|
679
|
+
- **`drift`** — model/behavior drift detection with helpers
|
|
680
|
+
- **`llmCosts`** — LLM usage cost tracking and optimization savings
|
|
681
|
+
|
|
682
|
+
### v4.0 → v4.1.0
|
|
524
683
|
|
|
525
684
|
- `roiAnalytics` now includes V3 methods: `getConfig()`, `createConfig()`, `updateConfig()`, `configVersions()`, `calculateV3()`, `trendV3()`
|
|
526
685
|
- `linking` now includes: `autoLink()`, `stats()`, `generateMarker()`
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ThinkHive SDK - Documents API
|
|
3
|
+
*
|
|
4
|
+
* Agent document management for RAG (Retrieval-Augmented Generation)
|
|
5
|
+
*/
|
|
6
|
+
/** An agent document used for RAG */
|
|
7
|
+
export interface Document {
|
|
8
|
+
id: string;
|
|
9
|
+
agentId: string;
|
|
10
|
+
fileName: string;
|
|
11
|
+
fileType: string;
|
|
12
|
+
fileSize: number;
|
|
13
|
+
status: string;
|
|
14
|
+
uploadedAt: string;
|
|
15
|
+
processedAt?: string;
|
|
16
|
+
metadata?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
/** Upload response with signed URL or document details */
|
|
19
|
+
export interface DocumentUploadResponse {
|
|
20
|
+
document: Document;
|
|
21
|
+
uploadUrl?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Documents API client for managing agent RAG documents
|
|
25
|
+
*/
|
|
26
|
+
export declare const documents: {
|
|
27
|
+
/**
|
|
28
|
+
* List all documents for an agent
|
|
29
|
+
*
|
|
30
|
+
* @param agentId - The agent ID
|
|
31
|
+
* @returns List of documents
|
|
32
|
+
*/
|
|
33
|
+
list(agentId: string): Promise<Document[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Upload a document for an agent
|
|
36
|
+
*
|
|
37
|
+
* @param agentId - The agent ID
|
|
38
|
+
* @param fileName - Name of the file
|
|
39
|
+
* @param fileType - MIME type of the file
|
|
40
|
+
* @param fileSize - Size of the file in bytes
|
|
41
|
+
* @returns Upload response with document details
|
|
42
|
+
*/
|
|
43
|
+
upload(agentId: string, fileName: string, fileType: string, fileSize: number): Promise<DocumentUploadResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Delete a document from an agent
|
|
46
|
+
*
|
|
47
|
+
* @param agentId - The agent ID
|
|
48
|
+
* @param docId - The document ID to delete
|
|
49
|
+
*/
|
|
50
|
+
remove(agentId: string, docId: string): Promise<void>;
|
|
51
|
+
};
|
|
52
|
+
export { documents as default };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ThinkHive SDK - Documents API
|
|
4
|
+
*
|
|
5
|
+
* Agent document management for RAG (Retrieval-Augmented Generation)
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.default = exports.documents = void 0;
|
|
9
|
+
const client_1 = require("../core/client");
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// DOCUMENTS API CLIENT
|
|
12
|
+
// ============================================================================
|
|
13
|
+
/**
|
|
14
|
+
* Documents API client for managing agent RAG documents
|
|
15
|
+
*/
|
|
16
|
+
exports.documents = {
|
|
17
|
+
/**
|
|
18
|
+
* List all documents for an agent
|
|
19
|
+
*
|
|
20
|
+
* @param agentId - The agent ID
|
|
21
|
+
* @returns List of documents
|
|
22
|
+
*/
|
|
23
|
+
async list(agentId) {
|
|
24
|
+
return (0, client_1.apiRequestWithData)(`/agents/${agentId}/documents`, {
|
|
25
|
+
apiVersion: 'none',
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Upload a document for an agent
|
|
30
|
+
*
|
|
31
|
+
* @param agentId - The agent ID
|
|
32
|
+
* @param fileName - Name of the file
|
|
33
|
+
* @param fileType - MIME type of the file
|
|
34
|
+
* @param fileSize - Size of the file in bytes
|
|
35
|
+
* @returns Upload response with document details
|
|
36
|
+
*/
|
|
37
|
+
async upload(agentId, fileName, fileType, fileSize) {
|
|
38
|
+
return (0, client_1.apiRequestWithData)(`/agents/${agentId}/documents`, {
|
|
39
|
+
method: 'POST',
|
|
40
|
+
body: { fileName, fileType, fileSize },
|
|
41
|
+
apiVersion: 'none',
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Delete a document from an agent
|
|
46
|
+
*
|
|
47
|
+
* @param agentId - The agent ID
|
|
48
|
+
* @param docId - The document ID to delete
|
|
49
|
+
*/
|
|
50
|
+
async remove(agentId, docId) {
|
|
51
|
+
return (0, client_1.apiRequest)(`/agents/${agentId}/documents/${docId}`, {
|
|
52
|
+
method: 'DELETE',
|
|
53
|
+
apiVersion: 'none',
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
exports.default = exports.documents;
|
|
58
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9jdW1lbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2FwaS9kb2N1bWVudHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7O0dBSUc7OztBQUVILDJDQUFnRTtBQXlCaEUsK0VBQStFO0FBQy9FLHVCQUF1QjtBQUN2QiwrRUFBK0U7QUFFL0U7O0dBRUc7QUFDVSxRQUFBLFNBQVMsR0FBRztJQUN2Qjs7Ozs7T0FLRztJQUNILEtBQUssQ0FBQyxJQUFJLENBQUMsT0FBZTtRQUN4QixPQUFPLElBQUEsMkJBQWtCLEVBQWEsV0FBVyxPQUFPLFlBQVksRUFBRTtZQUNwRSxVQUFVLEVBQUUsTUFBTTtTQUNuQixDQUFDLENBQUM7SUFDTCxDQUFDO0lBR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09PT09PT09PT09PT09PT09PT09XG5cbi8qKiBBbiBhZ2VudCBkb2N1bWVudCB1c2VkIGZvciBSQUcgKi9cbmV4cG9ydCBpbnRlcmZhY2UgRG9jdW1lbnQge1xuICBpZDogc3RyaW5nO1xuICBhZ2VudElkOiBzdHJpbmc7XG4gIGZpbGVOYW1lOiBzdHJpbmc7XG4gIGZpbGVUeXBlOiBzdHJpbmc7XG4gIGZpbGVTaXplOiBudW1iZXI7XG4gIHN0YXR1czogc3RyaW5nO1xuICB1cGxvYWRlZEF0OiBzdHJpbmc7XG4gIHByb2Nlc3NlZEF0Pzogc3RyaW5nO1xuICBtZXRhZGF0YT86IFJlY29yZDxzdHJpbmcsIHVua25vd24+O1xufVxuXG4vKiogVXBsb2FkIHJlc3BvbnNlIHdpdGggc2lnbmVkIFVSTCBvciBkb2N1bWVudCBkZXRhaWxzICovXG5leHBvcnQgaW50ZXJmYWNlIERvY3VtZW50VXBsb2FkUmVzcG9uc2Uge1xuICBkb2N1bWVudDogRG9jdW1lbnQ7XG4gIHVwbG9hZFVybD86IHN0cmluZztcbn1cblxuLy8gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PVxuLy8gRE9DVU1FTlRTIEFQSSBDTElFTlRcbi8vID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT1cblxuLyoqXG4gKiBEb2N1bWVudHMgQVBJIGNsaWVudCBmb3IgbWFuYWdpbmcgYWdlbnQgUkFHIGRvY3VtZW50c1xuICovXG5leHBvcnQgY29uc3QgZG9jdW1lbnRzID0ge1xuICAvKipcbiAgICogTGlzdCBhbGwgZG9jdW1lbnRzIGZvciBhbiBhZ2VudFxuICAgKlxuICAgKiBAcGFyYW0gYWdlbnRJZCAtIFRoZSBhZ2VudCBJRFxuICAgKiBAcmV0dXJucyBMaXN0IG9mIGRvY3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xuICB9LFxuXG4gIC8qKlxuICAgKiBEZWxldGUgYSBkb2N1bWVudCBmcm9tIGFuIGFnZW50XG4gICAqXG4gICAqIEBwYXJhbSBhZ2VudElkIC0gVGhlIGFnZW50IElEXG4gICAqIEBwYXJhbSBkb2NJZCAtIFRoZSBkb2N1bWVudCBJRCB0byBkZWxldGVcbiAgICovXG4gIGFzeW5jIHJlbW92ZShhZ2VudElkOiBzdHJpbmcsIGRvY0lkOiBzdHJpbmcpOiBQcm9taXNlPHZvaWQ+IHtcbiAgICByZXR1cm4gYXBpUmVxdWVzdDx2b2lkPihgL2FnZW50cy8ke2FnZW50SWR9L2RvY3VtZW50cy8ke2RvY0lkfWAsIHtcbiAgICAgIG1ldGhvZDogJ0RFTEVURScsXG4gICAgICBhcGlWZXJzaW9uOiAnbm9uZScsXG4gICAgfSk7XG4gIH0sXG59O1xuXG5leHBvcnQgeyBkb2N1bWVudHMgYXMgZGVmYXVsdCB9O1xuIl19
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ThinkHive SDK - Drift API
|
|
3
|
+
*
|
|
4
|
+
* Drift detection for monitoring agent behavior changes over time
|
|
5
|
+
*/
|
|
6
|
+
/** Options for drift detection */
|
|
7
|
+
export interface DetectDriftOptions {
|
|
8
|
+
startDate?: string;
|
|
9
|
+
endDate?: string;
|
|
10
|
+
}
|
|
11
|
+
/** A drift detection report */
|
|
12
|
+
export interface DriftReport {
|
|
13
|
+
agentId: string;
|
|
14
|
+
hasDrift: boolean;
|
|
15
|
+
severity: 'none' | 'low' | 'medium' | 'high';
|
|
16
|
+
driftScore: number;
|
|
17
|
+
dimensions: DriftDimension[];
|
|
18
|
+
analyzedFrom: string;
|
|
19
|
+
analyzedTo: string;
|
|
20
|
+
traceCount: number;
|
|
21
|
+
}
|
|
22
|
+
/** A dimension of drift analysis */
|
|
23
|
+
export interface DriftDimension {
|
|
24
|
+
name: string;
|
|
25
|
+
baseline: number;
|
|
26
|
+
current: number;
|
|
27
|
+
change: number;
|
|
28
|
+
changePercent: number;
|
|
29
|
+
isSignificant: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** Result of detect-all operation */
|
|
32
|
+
export interface DetectAllResult {
|
|
33
|
+
reports: DriftReport[];
|
|
34
|
+
agentsAnalyzed: number;
|
|
35
|
+
agentsWithDrift: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Drift API client for monitoring agent behavior changes
|
|
39
|
+
*/
|
|
40
|
+
export declare const drift: {
|
|
41
|
+
/**
|
|
42
|
+
* Detect drift for a specific agent
|
|
43
|
+
*
|
|
44
|
+
* @param agentId - The agent ID to analyze
|
|
45
|
+
* @param opts - Date range options
|
|
46
|
+
* @returns Drift detection report
|
|
47
|
+
*/
|
|
48
|
+
detect(agentId: string, opts?: DetectDriftOptions): Promise<DriftReport>;
|
|
49
|
+
/**
|
|
50
|
+
* Run drift detection across all agents
|
|
51
|
+
*
|
|
52
|
+
* @returns Drift reports for all agents
|
|
53
|
+
*/
|
|
54
|
+
detectAll(): Promise<DetectAllResult>;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Check if a drift report indicates drift was detected
|
|
58
|
+
*
|
|
59
|
+
* @param report - The drift report to check
|
|
60
|
+
* @returns Whether drift was detected
|
|
61
|
+
*/
|
|
62
|
+
export declare function hasDrift(report: DriftReport): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Get the severity level of a drift report
|
|
65
|
+
*
|
|
66
|
+
* @param report - The drift report to check
|
|
67
|
+
* @returns The drift severity level
|
|
68
|
+
*/
|
|
69
|
+
export declare function getDriftSeverity(report: DriftReport): 'none' | 'low' | 'medium' | 'high';
|
|
70
|
+
export { drift as default };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ThinkHive SDK - Drift API
|
|
4
|
+
*
|
|
5
|
+
* Drift detection for monitoring agent behavior changes over time
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.default = exports.drift = void 0;
|
|
9
|
+
exports.hasDrift = hasDrift;
|
|
10
|
+
exports.getDriftSeverity = getDriftSeverity;
|
|
11
|
+
const client_1 = require("../core/client");
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// DRIFT API CLIENT
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Drift API client for monitoring agent behavior changes
|
|
17
|
+
*/
|
|
18
|
+
exports.drift = {
|
|
19
|
+
/**
|
|
20
|
+
* Detect drift for a specific agent
|
|
21
|
+
*
|
|
22
|
+
* @param agentId - The agent ID to analyze
|
|
23
|
+
* @param opts - Date range options
|
|
24
|
+
* @returns Drift detection report
|
|
25
|
+
*/
|
|
26
|
+
async detect(agentId, opts) {
|
|
27
|
+
const params = new URLSearchParams();
|
|
28
|
+
if (opts?.startDate)
|
|
29
|
+
params.set('startDate', opts.startDate);
|
|
30
|
+
if (opts?.endDate)
|
|
31
|
+
params.set('endDate', opts.endDate);
|
|
32
|
+
const query = params.toString();
|
|
33
|
+
return (0, client_1.apiRequestWithData)(`/drift/${agentId}${query ? `?${query}` : ''}`, {
|
|
34
|
+
apiVersion: 'none',
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* Run drift detection across all agents
|
|
39
|
+
*
|
|
40
|
+
* @returns Drift reports for all agents
|
|
41
|
+
*/
|
|
42
|
+
async detectAll() {
|
|
43
|
+
return (0, client_1.apiRequestWithData)('/drift/detect-all', {
|
|
44
|
+
method: 'POST',
|
|
45
|
+
apiVersion: 'none',
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
exports.default = exports.drift;
|
|
50
|
+
// ============================================================================
|
|
51
|
+
// HELPER FUNCTIONS
|
|
52
|
+
// ============================================================================
|
|
53
|
+
/**
|
|
54
|
+
* Check if a drift report indicates drift was detected
|
|
55
|
+
*
|
|
56
|
+
* @param report - The drift report to check
|
|
57
|
+
* @returns Whether drift was detected
|
|
58
|
+
*/
|
|
59
|
+
function hasDrift(report) {
|
|
60
|
+
return report.hasDrift;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get the severity level of a drift report
|
|
64
|
+
*
|
|
65
|
+
* @param report - The drift report to check
|
|
66
|
+
* @returns The drift severity level
|
|
67
|
+
*/
|
|
68
|
+
function getDriftSeverity(report) {
|
|
69
|
+
return report.severity;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHJpZnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXBpL2RyaWZ0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7OztHQUlHOzs7QUE0RkgsNEJBRUM7QUFRRCw0Q0FFQztBQXRHRCwyQ0FBb0Q7QUF5Q3BELCtFQUErRTtBQUMvRSxtQkFBbUI7QUFDbkIsK0VBQStFO0FBRS9FOztHQUVHO0FBQ1UsUUFBQSxLQUFLLEdBQUc7SUFDbkI7Ozs7OztPQU1HO0lBQ0gsS0FBSyxDQUFDLE1BQU0sQ0FBQyxPQUFlLEVBQUUsSUFBeUI7UUFDckQsTUFBTSxNQUFNLEdBQUcsSUFBSSxlQUFlLEVBQUUsQ0FBQztRQUNyQyxJQUFJLElBQUksRUFBRSxTQUFTO1lBQUUsTUFBTSxDQUFDLEdBQUcsQ0FBQyxXQUFXLEVBQUUsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFDO1FBQzdELElBQUksSUFBSSxFQUFFLE9BQU87WUFBRSxNQUFNLENBQUMsR0FBRyxDQUFDLFNBQVMsRUFBRSxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUM7UUFFdkQsTUFBTSxLQUFLLEdBQUcsTUFBTSxDQUFDLFFBQVEsRUFBRSxDQUFDO1FBQ2hDLE9BQU8sSUFBQSwyQkFBa0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XNEcmlmdDtcbn1cblxuLyoqXG4gKiBHZXQgdGhlIHNldmVyaXR5IGxldmVsIG9mIGEgZHJpZnQgcmVwb3J0XG4gKlxuICogQHBhcmFtIHJlcG9ydCAtIFRoZSBkcmlmdCByZXBvcnQgdG8gY2hlY2tcbiAqIEByZXR1cm5zIFRoZSBkcmlmdCBzZXZlcml0eSBsZXZlbFxuICovXG5leHBvcnQgZnVuY3Rpb24gZ2V0RHJpZnRTZXZlcml0eShyZXBvcnQ6IERyaWZ0UmVwb3J0KTogJ25vbmUnIHwgJ2xvdycgfCAnbWVkaXVtJyB8ICdoaWdoJyB7XG4gIHJldHVybiByZXBvcnQuc2V2ZXJpdHk7XG59XG5cbmV4cG9ydCB7IGRyaWZ0IGFzIGRlZmF1bHQgfTtcbiJdfQ==
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ThinkHive SDK - Eval Runs API
|
|
3
|
+
*
|
|
4
|
+
* Evaluation run management for agent quality assessment
|
|
5
|
+
*/
|
|
6
|
+
/** Options for creating an evaluation run */
|
|
7
|
+
export interface CreateEvalRunOptions {
|
|
8
|
+
traceIds?: string[];
|
|
9
|
+
criteriaIds?: string[];
|
|
10
|
+
confidenceLevel?: number;
|
|
11
|
+
useLLM?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** Options for listing evaluation run results */
|
|
14
|
+
export interface GetEvalRunResultsOptions {
|
|
15
|
+
limit?: number;
|
|
16
|
+
offset?: number;
|
|
17
|
+
passedOnly?: boolean;
|
|
18
|
+
failedOnly?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Options for listing evaluation runs */
|
|
21
|
+
export interface ListEvalRunsOptions {
|
|
22
|
+
agentId?: string;
|
|
23
|
+
limit?: number;
|
|
24
|
+
}
|
|
25
|
+
/** Options for estimating evaluation cost */
|
|
26
|
+
export interface EstimateCostOptions {
|
|
27
|
+
traceIds?: string[];
|
|
28
|
+
criteriaIds?: string[];
|
|
29
|
+
confidenceLevel?: number;
|
|
30
|
+
useLLM?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** Options for getting trace-level results */
|
|
33
|
+
export interface GetTraceResultsOptions {
|
|
34
|
+
latest?: boolean;
|
|
35
|
+
includeCriteria?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** An evaluation run */
|
|
38
|
+
export interface EvalRun {
|
|
39
|
+
id: string;
|
|
40
|
+
agentId: string;
|
|
41
|
+
status: string;
|
|
42
|
+
traceCount: number;
|
|
43
|
+
criteriaCount: number;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
completedAt?: string;
|
|
46
|
+
}
|
|
47
|
+
/** A single evaluation result */
|
|
48
|
+
export interface EvalResult {
|
|
49
|
+
id: string;
|
|
50
|
+
runId: string;
|
|
51
|
+
traceId: string;
|
|
52
|
+
criterionId: string;
|
|
53
|
+
passed: boolean;
|
|
54
|
+
score: number;
|
|
55
|
+
reasoning?: string;
|
|
56
|
+
}
|
|
57
|
+
/** Cost estimate for an evaluation run */
|
|
58
|
+
export interface EvalCostEstimate {
|
|
59
|
+
estimatedTraces: number;
|
|
60
|
+
estimatedCriteria: number;
|
|
61
|
+
estimatedCost: number;
|
|
62
|
+
estimatedCredits: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Evaluation runs API client for managing agent evaluation workflows
|
|
66
|
+
*/
|
|
67
|
+
export declare const evalRuns: {
|
|
68
|
+
/**
|
|
69
|
+
* Create a new evaluation run for an agent
|
|
70
|
+
*
|
|
71
|
+
* @param agentId - The agent to evaluate
|
|
72
|
+
* @param opts - Optional configuration for the evaluation run
|
|
73
|
+
* @returns The created evaluation run
|
|
74
|
+
*/
|
|
75
|
+
create(agentId: string, opts?: CreateEvalRunOptions): Promise<EvalRun>;
|
|
76
|
+
/**
|
|
77
|
+
* Get an evaluation run by ID
|
|
78
|
+
*
|
|
79
|
+
* @param runId - The evaluation run ID
|
|
80
|
+
* @returns The evaluation run details
|
|
81
|
+
*/
|
|
82
|
+
get(runId: string): Promise<EvalRun>;
|
|
83
|
+
/**
|
|
84
|
+
* Get results for an evaluation run
|
|
85
|
+
*
|
|
86
|
+
* @param runId - The evaluation run ID
|
|
87
|
+
* @param opts - Pagination and filter options
|
|
88
|
+
* @returns Paginated evaluation results
|
|
89
|
+
*/
|
|
90
|
+
getResults(runId: string, opts?: GetEvalRunResultsOptions): Promise<{
|
|
91
|
+
results: EvalResult[];
|
|
92
|
+
limit: number;
|
|
93
|
+
offset: number;
|
|
94
|
+
hasMore: boolean;
|
|
95
|
+
}>;
|
|
96
|
+
/**
|
|
97
|
+
* List evaluation runs with optional filters
|
|
98
|
+
*
|
|
99
|
+
* @param opts - Filter and pagination options
|
|
100
|
+
* @returns List of evaluation runs
|
|
101
|
+
*/
|
|
102
|
+
list(opts?: ListEvalRunsOptions): Promise<EvalRun[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Estimate the cost of running an evaluation
|
|
105
|
+
*
|
|
106
|
+
* @param agentId - The agent to estimate cost for
|
|
107
|
+
* @param opts - Evaluation configuration for cost estimation
|
|
108
|
+
* @returns Cost estimate details
|
|
109
|
+
*/
|
|
110
|
+
estimateCost(agentId: string, opts?: EstimateCostOptions): Promise<EvalCostEstimate>;
|
|
111
|
+
/**
|
|
112
|
+
* Get evaluation results for a specific trace
|
|
113
|
+
*
|
|
114
|
+
* @param traceId - The trace ID to get results for
|
|
115
|
+
* @param opts - Options for filtering results
|
|
116
|
+
* @returns Evaluation results for the trace
|
|
117
|
+
*/
|
|
118
|
+
getTraceResults(traceId: string, opts?: GetTraceResultsOptions): Promise<EvalResult[]>;
|
|
119
|
+
/**
|
|
120
|
+
* Delete an evaluation run
|
|
121
|
+
*
|
|
122
|
+
* @param runId - The evaluation run ID to delete
|
|
123
|
+
*/
|
|
124
|
+
remove(runId: string): Promise<void>;
|
|
125
|
+
};
|
|
126
|
+
export { evalRuns as default };
|