@thinkhive/sdk 3.1.0 → 3.3.0

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/dist/index.d.ts CHANGED
@@ -11,13 +11,33 @@
11
11
  * @license MIT
12
12
  */
13
13
  import { isInitialized, SDK_VERSION, DEFAULT_ENDPOINT } from './core/config';
14
- import { ThinkHiveApiError, ThinkHiveValidationError } from './core/client';
14
+ import { ThinkHiveError, ThinkHiveApiError, ThinkHiveValidationError, PermissionDeniedError, AgentScopeError, RateLimitError, IpWhitelistError } from './core/client';
15
15
  import { runs, createRunWithContext, toOpenAIMessages, fromOpenAIMessages } from './api/runs';
16
16
  import { claims, isFact, isInference, isComputed, getHighConfidenceClaims, groupClaimsByType, groupClaimsByCategory } from './api/claims';
17
17
  import { calibration, calculateBrierScore, calculateECE, isWellCalibrated, getCalibrationQuality } from './api/calibration';
18
+ import { humanReview } from './api/human-review';
19
+ import { nondeterminism, calculatePassAtK, calculatePassToK, requiredPassRateForPassAtK, isReliableEvaluation, getReliabilityRecommendation } from './api/nondeterminism';
20
+ import { evalHealth, hasHealthIssue, getSeverityLevel as getHealthSeverityLevel, isSaturated, getSaturationRecommendation } from './api/eval-health';
21
+ import { deterministicGraders, createRegexRule, createContainsRule, createLengthRule, createJsonSchemaRule, allRulesPassed, getFailedRules, calculateAverageScore } from './api/deterministic-graders';
22
+ import { conversationEval, aggregateWorst, aggregateAverage, aggregateWeighted, aggregateFinalTurn, aggregateMajority, getAggregator, getProblematicTurns, analyzeConversationTrend } from './api/conversation-eval';
23
+ import { transcriptPatterns, isHighRisk, getMatchesByCategory, getCriticalInsights, hasPiiExposure, hasFrustrationSignals, hasEscalationRequest, getCategoryDistribution, getRecommendations, needsAttention, sortMatchesBySeverity } from './api/transcript-patterns';
24
+ import { apiKeys, hasPermission, isExpired as isApiKeyExpired, isValid as isApiKeyValid, getTimeUntilExpiry, canAccessAgent } from './api/apiKeys';
25
+ import { roiAnalytics, calculateRevenueAtRisk, calculateAutomationSavings, formatCurrency, getROIQuality } from './api/roi-analytics';
26
+ import { businessMetrics, isMetricReady, needsMoreTraces, awaitingExternalData, isMetricStale, getStatusMessage, getTraceProgress, formatMetricValue, getTrendEmoji } from './api/business-metrics';
27
+ import { qualityMetrics, passesQualityThreshold, isHallucinationRiskAcceptable, getQualityRecommendations, formatQualityScore, getGradeColor } from './api/quality-metrics';
18
28
  import { linking, generateZendeskMarker, parseZendeskMarker, hasZendeskMarker, removeZendeskMarker, linkRunToTicket, linkRunToZendeskTicket, getBestLinkMethod, LINK_METHOD_CONFIDENCE } from './integrations/ticket-linking';
19
29
  import { customerContext, captureCustomerContext, getContextAsOf, toContextSnapshot, calculateArrChange, calculateHealthTrend } from './integrations/customer-context';
20
- export type { InitOptions, Framework, RunOptions, RunOutcome, ConversationMessage, CustomerContextSnapshot, TicketLinkingOptions, LinkMethod, TraceOptions, SpanData, BusinessContext, Claim, ClaimType, ClaimCategory, ConfidenceCalibration, EvidenceReference, AnalysisResult, CalibrationStatus, CalibrationBucket, PredictionType, RoiConfig, RoiSummary, ExplainabilityResult, ApiResponse, PaginatedResponse, RunResponse, } from './core/types';
30
+ export type { InitOptions, Framework, RunOptions, RunOutcome, ConversationMessage, CustomerContextSnapshot, TicketLinkingOptions, LinkMethod, TraceOptions, TraceCustomFlag, SpanData, BusinessContext, Claim, ClaimType, ClaimCategory, ConfidenceCalibration, EvidenceReference, AnalysisResult, CalibrationStatus, CalibrationBucket, PredictionType, RoiConfig, RoiSummary, ExplainabilityResult, ApiResponse, PaginatedResponse, RunResponse, } from './core/types';
31
+ export type { HumanReviewStatus, HumanReviewType, HumanReviewQueueItem, CalibrationSet, ReviewerCalibration, QueueStats, } from './api/human-review';
32
+ export type { NondeterminismRunType, NondeterminismRunStatus, NondeterminismRun, NondeterminismSample, TraceAnalysis, CriterionAnalysis, RunSummary, } from './api/nondeterminism';
33
+ export type { SaturationType, HealthStatus, RegressionSeverity, EvalHealthSnapshot, EvalRegression, HealthReport, } from './api/eval-health';
34
+ export type { RuleType, DeterministicEvalResult, RuleResult, RuleTypeInfo, RuleTemplate, } from './api/deterministic-graders';
35
+ export type { AggregateMethod, SessionTrace, TurnEvaluation, ConversationEvalResult, AggregationMethodInfo, } from './api/conversation-eval';
36
+ export type { PatternCategory, PatternOutcome, PatternSeverity, PatternMatch, PatternInsight, AnalysisResult as PatternAnalysisResult, PatternCategoryInfo, BuiltInPattern, } from './api/transcript-patterns';
37
+ export type { ApiKeyPermissions, ScopeType, Environment, CreateApiKeyOptions, ApiKey, CreateApiKeyResult, } from './api/apiKeys';
38
+ export type { IndustryConfig, CustomIndustryConfig, ROIMetrics, BusinessImpact, ROISummary, TrendDataPoint, Correlation, PatternCluster, CorrelationAnalysis, } from './api/roi-analytics';
39
+ export type { RetrievedContext, GroundTruthContext, GroundedSpan, UngroundedSpan, CitationMap, RAGEvaluation, RAGEvidence, HallucinationInstance, HallucinationReport, GroundednessResult, BatchEvaluationResult, BatchEvaluationSummary, } from './api/quality-metrics';
40
+ export type { MetricTrend, MetricStatus, CurrentMetricResponse, MetricHistoryPoint, MetricHistorySummary, MetricHistoryResponse, RecordMetricOptions, RecordMetricResponse, } from './api/business-metrics';
21
41
  /**
22
42
  * Initialize ThinkHive SDK v3
23
43
  *
@@ -75,52 +95,128 @@ export declare function traceChain<T>(options: {
75
95
  input?: unknown;
76
96
  }, fn: () => Promise<T>): Promise<T>;
77
97
  /**
78
- * Explainer API client (v2 compatibility)
79
- * @deprecated Use runs and claims APIs instead
98
+ * Issues API client
99
+ * This is the recommended API for managing clustered failure patterns
100
+ *
101
+ * @since 3.1.0
80
102
  */
81
- export declare const explainer: {
103
+ export declare const issues: {
104
+ /**
105
+ * List issues for an agent
106
+ */
107
+ list(agentId: string, options?: {
108
+ status?: string;
109
+ startDate?: Date;
110
+ endDate?: Date;
111
+ limit?: number;
112
+ offset?: number;
113
+ }): Promise<any[]>;
114
+ /**
115
+ * Get a single issue by ID
116
+ */
117
+ get(id: string): Promise<any>;
118
+ /**
119
+ * Create a new issue
120
+ */
121
+ create(data: {
122
+ agentId: string;
123
+ title: string;
124
+ description?: string;
125
+ type: string;
126
+ severity?: string;
127
+ pattern?: string;
128
+ exampleTraceIds?: string[];
129
+ }): Promise<any>;
130
+ /**
131
+ * Update an issue
132
+ */
133
+ update(id: string, data: {
134
+ title?: string;
135
+ description?: string;
136
+ status?: string;
137
+ severity?: string;
138
+ assignedTo?: string;
139
+ resolutionNotes?: string;
140
+ }): Promise<any>;
82
141
  /**
83
- * Analyze a trace (v2 format)
84
- * @deprecated Use runs.create() + claims.getRunAnalysis() instead
142
+ * Get fixes for an issue
85
143
  */
86
- analyze(traceData: import("./core/types").TraceOptions, options?: {
87
- tier?: string;
88
- includeRagEvaluation?: boolean;
89
- includeHallucinationCheck?: boolean;
90
- waitForResult?: boolean;
91
- webhookUrl?: string;
92
- }): Promise<import("./core/types").ExplainabilityResult>;
144
+ getFixes(issueId: string): Promise<any[]>;
145
+ };
146
+ /**
147
+ * Analyzer API client
148
+ * User-selected trace analysis with cost estimation and smart sampling
149
+ *
150
+ * Key improvements over v1 Explainer:
151
+ * - User-selected trace analysis (not automatic)
152
+ * - Cost estimation before execution
153
+ * - Smart sampling strategies
154
+ * - Root cause analysis by layer
155
+ * - Pattern aggregation across traces
156
+ *
157
+ * @since 3.1.0
158
+ */
159
+ export declare const analyzer: {
93
160
  /**
94
- * Get a previously analyzed trace
95
- * @deprecated
161
+ * Analyze specific traces (user-selected)
96
162
  */
97
- get(traceId: string): Promise<import("./core/types").ExplainabilityResult>;
163
+ analyze(options: {
164
+ traceIds: string[];
165
+ tier?: "fast" | "standard" | "deep";
166
+ includeRootCause?: boolean;
167
+ includeLayers?: boolean;
168
+ }): Promise<any>;
98
169
  /**
99
- * Search traces semantically
100
- * @deprecated
170
+ * Analyze traces by time window
101
171
  */
102
- search(params: {
103
- query: string;
172
+ analyzeWindow(options: {
173
+ agentId: string;
174
+ startDate: Date;
175
+ endDate: Date;
104
176
  filters?: {
105
- outcome?: string;
106
- minImpactScore?: number;
107
- dateRange?: {
108
- from: Date;
109
- to: Date;
110
- };
177
+ outcomes?: ("failure" | "error" | "success")[];
178
+ minSeverity?: "low" | "medium" | "high" | "critical";
111
179
  };
112
- limit?: number;
180
+ sampling?: {
181
+ strategy: "all" | "failures_only" | "smart" | "random";
182
+ samplePercent?: number;
183
+ };
184
+ }): Promise<any>;
185
+ /**
186
+ * Estimate cost before running analysis
187
+ */
188
+ estimateCost(options: {
189
+ traceIds?: string[];
190
+ agentId?: string;
191
+ startDate?: Date;
192
+ endDate?: Date;
193
+ tier: "fast" | "standard" | "deep";
113
194
  }): Promise<{
114
- results: Array<import("./core/types").ExplainabilityResult & {
115
- similarity: number;
116
- }>;
117
- total: number;
195
+ estimatedTraces: number;
196
+ estimatedTokens: number;
197
+ estimatedCost: number;
198
+ estimatedCredits: number;
199
+ tier: string;
200
+ note: string;
118
201
  }>;
202
+ /**
203
+ * Get analysis results for a specific trace
204
+ */
205
+ get(traceId: string): Promise<any>;
206
+ /**
207
+ * Aggregate insights across multiple analyzed traces
208
+ */
209
+ summarize(options: {
210
+ analysisIds?: string[];
211
+ agentId?: string;
212
+ startDate?: Date;
213
+ endDate?: Date;
214
+ }): Promise<any>;
119
215
  };
120
216
  export { isInitialized, SDK_VERSION, DEFAULT_ENDPOINT };
121
- export { runs, claims, calibration, linking, customerContext, };
122
- export { createRunWithContext, toOpenAIMessages, fromOpenAIMessages, isFact, isInference, isComputed, getHighConfidenceClaims, groupClaimsByType, groupClaimsByCategory, calculateBrierScore, calculateECE, isWellCalibrated, getCalibrationQuality, generateZendeskMarker, parseZendeskMarker, hasZendeskMarker, removeZendeskMarker, linkRunToTicket, linkRunToZendeskTicket, getBestLinkMethod, LINK_METHOD_CONFIDENCE, captureCustomerContext, getContextAsOf, toContextSnapshot, calculateArrChange, calculateHealthTrend, };
123
- export { ThinkHiveApiError, ThinkHiveValidationError };
217
+ export { runs, claims, calibration, linking, customerContext, humanReview, nondeterminism, evalHealth, deterministicGraders, conversationEval, transcriptPatterns, apiKeys, roiAnalytics, qualityMetrics, businessMetrics, };
218
+ export { createRunWithContext, toOpenAIMessages, fromOpenAIMessages, isFact, isInference, isComputed, getHighConfidenceClaims, groupClaimsByType, groupClaimsByCategory, calculateBrierScore, calculateECE, isWellCalibrated, getCalibrationQuality, generateZendeskMarker, parseZendeskMarker, hasZendeskMarker, removeZendeskMarker, linkRunToTicket, linkRunToZendeskTicket, getBestLinkMethod, LINK_METHOD_CONFIDENCE, captureCustomerContext, getContextAsOf, toContextSnapshot, calculateArrChange, calculateHealthTrend, calculatePassAtK, calculatePassToK, requiredPassRateForPassAtK, isReliableEvaluation, getReliabilityRecommendation, hasHealthIssue, getHealthSeverityLevel, isSaturated, getSaturationRecommendation, createRegexRule, createContainsRule, createLengthRule, createJsonSchemaRule, allRulesPassed, getFailedRules, calculateAverageScore, aggregateWorst, aggregateAverage, aggregateWeighted, aggregateFinalTurn, aggregateMajority, getAggregator, getProblematicTurns, analyzeConversationTrend, isHighRisk, getMatchesByCategory, getCriticalInsights, hasPiiExposure, hasFrustrationSignals, hasEscalationRequest, getCategoryDistribution, getRecommendations, needsAttention, sortMatchesBySeverity, hasPermission, isApiKeyExpired, isApiKeyValid, getTimeUntilExpiry, canAccessAgent, calculateRevenueAtRisk, calculateAutomationSavings, formatCurrency, getROIQuality, passesQualityThreshold, isHallucinationRiskAcceptable, getQualityRecommendations, formatQualityScore, getGradeColor, isMetricReady, needsMoreTraces, awaitingExternalData, isMetricStale, getStatusMessage, getTraceProgress, formatMetricValue, getTrendEmoji, };
219
+ export { ThinkHiveError, ThinkHiveApiError, ThinkHiveValidationError, PermissionDeniedError, AgentScopeError, RateLimitError, IpWhitelistError, };
124
220
  declare const _default: {
125
221
  init: typeof init;
126
222
  getTracer: typeof getTracer;
@@ -288,44 +384,290 @@ declare const _default: {
288
384
  getLatestSnapshot(customerId: string): Promise<import("./integrations/customer-context").CustomerMetricsSnapshot | null>;
289
385
  getSnapshotAsOf(customerId: string, timestamp: string | Date): Promise<import("./integrations/customer-context").CustomerMetricsSnapshot | null>;
290
386
  };
291
- explainer: {
387
+ humanReview: {
388
+ getQueue(options?: import("./api/human-review").ListQueueOptions): Promise<import("./api/human-review").HumanReviewQueueItem[]>;
389
+ addToQueue(options: import("./api/human-review").AddToQueueOptions): Promise<import("./api/human-review").HumanReviewQueueItem>;
390
+ getItem(itemId: string): Promise<import("./api/human-review").HumanReviewQueueItem>;
391
+ claim(itemId: string): Promise<import("./api/human-review").HumanReviewQueueItem>;
392
+ release(itemId: string): Promise<import("./api/human-review").HumanReviewQueueItem>;
393
+ skip(itemId: string): Promise<import("./api/human-review").HumanReviewQueueItem>;
394
+ submit(itemId: string, review: import("./api/human-review").SubmitReviewOptions): Promise<import("./api/human-review").HumanReviewQueueItem>;
395
+ getStats(agentId?: string): Promise<import("./api/human-review").QueueStats>;
396
+ getNextItem(agentId?: string): Promise<import("./api/human-review").HumanReviewQueueItem | null>;
397
+ getReviewTypes(): Promise<Array<{
398
+ id: string;
399
+ name: string;
400
+ description: string;
401
+ autoTrigger: boolean;
402
+ }>>;
403
+ getCalibrationSets(agentId?: string): Promise<import("./api/human-review").CalibrationSet[]>;
404
+ createCalibrationSet(options: import("./api/human-review").CreateCalibrationSetOptions): Promise<import("./api/human-review").CalibrationSet>;
405
+ getCalibrationSet(setId: string): Promise<import("./api/human-review").CalibrationSet>;
406
+ getCertifiedReviewers(calibrationSetId: string): Promise<import("./api/human-review").ReviewerCalibration[]>;
407
+ getReviewerCalibrations(userId: string): Promise<import("./api/human-review").ReviewerCalibration[]>;
408
+ };
409
+ nondeterminism: {
410
+ createRun(options: import("./api/nondeterminism").CreateRunOptions): Promise<import("./api/nondeterminism").NondeterminismRun>;
411
+ getRuns(options?: import("./api/nondeterminism").ListRunsOptions): Promise<import("./api/nondeterminism").NondeterminismRun[]>;
412
+ getRun(runId: string): Promise<import("./api/nondeterminism").NondeterminismRun>;
413
+ startRun(runId: string): Promise<void>;
414
+ completeRun(runId: string): Promise<void>;
415
+ recordSample(options: import("./api/nondeterminism").RecordSampleOptions): Promise<import("./api/nondeterminism").NondeterminismSample>;
416
+ getSamples(runId: string): Promise<import("./api/nondeterminism").NondeterminismSample[]>;
417
+ getRunSummary(runId: string): Promise<import("./api/nondeterminism").RunSummary>;
418
+ analyzeRun(runId: string): Promise<import("./api/nondeterminism").RunSummary>;
419
+ getInfo(): Promise<import("./api/nondeterminism").PassAtKInfo>;
420
+ };
421
+ evalHealth: {
422
+ getReport(agentId: string): Promise<import("./api/eval-health").HealthReport>;
423
+ getSnapshots(options: import("./api/eval-health").GetSnapshotsOptions): Promise<import("./api/eval-health").EvalHealthSnapshot[]>;
424
+ getLatestSnapshot(agentId: string, criterionId?: string): Promise<import("./api/eval-health").EvalHealthSnapshot | null>;
425
+ recordSnapshot(options: import("./api/eval-health").CreateSnapshotOptions): Promise<import("./api/eval-health").EvalHealthSnapshot>;
426
+ getRegressions(agentId: string): Promise<import("./api/eval-health").EvalRegression[]>;
427
+ recordRegression(options: import("./api/eval-health").CreateRegressionOptions): Promise<import("./api/eval-health").EvalRegression>;
428
+ resolveRegression(regressionId: string, options: import("./api/eval-health").ResolveRegressionOptions): Promise<void>;
429
+ acknowledgeRegression(regressionId: string): Promise<void>;
430
+ };
431
+ deterministicGraders: {
432
+ evaluate(options: import("./api/deterministic-graders").EvaluateOptions): Promise<import("./api/deterministic-graders").DeterministicEvalResult>;
433
+ bulkEvaluate(options: import("./api/deterministic-graders").BulkEvaluateOptions): Promise<import("./api/deterministic-graders").BulkEvaluateResult>;
434
+ getRuleTypes(): Promise<import("./api/deterministic-graders").RuleTypeInfo[]>;
435
+ getTemplates(): Promise<import("./api/deterministic-graders").RuleTemplate[]>;
436
+ };
437
+ conversationEval: {
438
+ getSessionTraces(sessionId: string): Promise<import("./api/conversation-eval").SessionTrace[]>;
439
+ evaluate(options: import("./api/conversation-eval").EvaluateConversationOptions): Promise<import("./api/conversation-eval").ConversationEvalResult>;
440
+ getAggregationMethods(): Promise<import("./api/conversation-eval").AggregationMethodInfo[]>;
441
+ };
442
+ transcriptPatterns: {
443
+ analyze(traceId: string): Promise<import("./api/transcript-patterns").AnalysisResult>;
444
+ bulkAnalyze(traceIds: string[]): Promise<import("./api/transcript-patterns").BulkAnalysisResult>;
445
+ getCategories(): Promise<import("./api/transcript-patterns").PatternCategoryInfo[]>;
446
+ getBuiltInPatterns(): Promise<import("./api/transcript-patterns").BuiltInPattern[]>;
447
+ };
448
+ apiKeys: {
449
+ create: typeof import("./api/apiKeys").create;
450
+ list: typeof import("./api/apiKeys").list;
451
+ revoke: typeof import("./api/apiKeys").revoke;
452
+ rotate: typeof import("./api/apiKeys").rotate;
453
+ test: typeof import("./api/apiKeys").test;
454
+ hasPermission: typeof hasPermission;
455
+ isExpired: typeof isApiKeyExpired;
456
+ isValid: typeof isApiKeyValid;
457
+ getTimeUntilExpiry: typeof getTimeUntilExpiry;
458
+ canAccessAgent: typeof canAccessAgent;
459
+ };
460
+ issues: {
292
461
  /**
293
- * Analyze a trace (v2 format)
294
- * @deprecated Use runs.create() + claims.getRunAnalysis() instead
462
+ * List issues for an agent
295
463
  */
296
- analyze(traceData: import("./core/types").TraceOptions, options?: {
297
- tier?: string;
298
- includeRagEvaluation?: boolean;
299
- includeHallucinationCheck?: boolean;
300
- waitForResult?: boolean;
301
- webhookUrl?: string;
302
- }): Promise<import("./core/types").ExplainabilityResult>;
464
+ list(agentId: string, options?: {
465
+ status?: string;
466
+ startDate?: Date;
467
+ endDate?: Date;
468
+ limit?: number;
469
+ offset?: number;
470
+ }): Promise<any[]>;
303
471
  /**
304
- * Get a previously analyzed trace
305
- * @deprecated
472
+ * Get a single issue by ID
306
473
  */
307
- get(traceId: string): Promise<import("./core/types").ExplainabilityResult>;
474
+ get(id: string): Promise<any>;
308
475
  /**
309
- * Search traces semantically
310
- * @deprecated
476
+ * Create a new issue
311
477
  */
312
- search(params: {
313
- query: string;
478
+ create(data: {
479
+ agentId: string;
480
+ title: string;
481
+ description?: string;
482
+ type: string;
483
+ severity?: string;
484
+ pattern?: string;
485
+ exampleTraceIds?: string[];
486
+ }): Promise<any>;
487
+ /**
488
+ * Update an issue
489
+ */
490
+ update(id: string, data: {
491
+ title?: string;
492
+ description?: string;
493
+ status?: string;
494
+ severity?: string;
495
+ assignedTo?: string;
496
+ resolutionNotes?: string;
497
+ }): Promise<any>;
498
+ /**
499
+ * Get fixes for an issue
500
+ */
501
+ getFixes(issueId: string): Promise<any[]>;
502
+ };
503
+ analyzer: {
504
+ /**
505
+ * Analyze specific traces (user-selected)
506
+ */
507
+ analyze(options: {
508
+ traceIds: string[];
509
+ tier?: "fast" | "standard" | "deep";
510
+ includeRootCause?: boolean;
511
+ includeLayers?: boolean;
512
+ }): Promise<any>;
513
+ /**
514
+ * Analyze traces by time window
515
+ */
516
+ analyzeWindow(options: {
517
+ agentId: string;
518
+ startDate: Date;
519
+ endDate: Date;
314
520
  filters?: {
315
- outcome?: string;
316
- minImpactScore?: number;
317
- dateRange?: {
318
- from: Date;
319
- to: Date;
320
- };
521
+ outcomes?: ("failure" | "error" | "success")[];
522
+ minSeverity?: "low" | "medium" | "high" | "critical";
321
523
  };
322
- limit?: number;
524
+ sampling?: {
525
+ strategy: "all" | "failures_only" | "smart" | "random";
526
+ samplePercent?: number;
527
+ };
528
+ }): Promise<any>;
529
+ /**
530
+ * Estimate cost before running analysis
531
+ */
532
+ estimateCost(options: {
533
+ traceIds?: string[];
534
+ agentId?: string;
535
+ startDate?: Date;
536
+ endDate?: Date;
537
+ tier: "fast" | "standard" | "deep";
323
538
  }): Promise<{
324
- results: Array<import("./core/types").ExplainabilityResult & {
325
- similarity: number;
539
+ estimatedTraces: number;
540
+ estimatedTokens: number;
541
+ estimatedCost: number;
542
+ estimatedCredits: number;
543
+ tier: string;
544
+ note: string;
545
+ }>;
546
+ /**
547
+ * Get analysis results for a specific trace
548
+ */
549
+ get(traceId: string): Promise<any>;
550
+ /**
551
+ * Aggregate insights across multiple analyzed traces
552
+ */
553
+ summarize(options: {
554
+ analysisIds?: string[];
555
+ agentId?: string;
556
+ startDate?: Date;
557
+ endDate?: Date;
558
+ }): Promise<any>;
559
+ };
560
+ roiAnalytics: {
561
+ summary(options?: {
562
+ startDate?: string | Date;
563
+ endDate?: string | Date;
564
+ agentId?: string;
565
+ }): Promise<import("./api/roi-analytics").ROISummary>;
566
+ byAgent(agentId: string, options?: {
567
+ startDate?: string | Date;
568
+ endDate?: string | Date;
569
+ }): Promise<{
570
+ agent: {
571
+ id: string;
572
+ name: string;
573
+ industry: string;
574
+ };
575
+ industryConfig: Partial<import("./api/roi-analytics").IndustryConfig>;
576
+ roi: import("./api/roi-analytics").ROIMetrics;
577
+ recentImpacts: Array<{
578
+ impactScore: number;
579
+ revenueRisk: number;
580
+ roiCategory: string;
581
+ totalFinancialImpact: number;
326
582
  }>;
327
- total: number;
328
583
  }>;
584
+ trends(options?: {
585
+ startDate?: string | Date;
586
+ endDate?: string | Date;
587
+ agentId?: string;
588
+ }): Promise<import("./api/roi-analytics").TrendDataPoint[]>;
589
+ calculate(options: {
590
+ traceId?: string;
591
+ userMessage?: string;
592
+ agentResponse?: string;
593
+ industryConfig?: import("./api/roi-analytics").CustomIndustryConfig;
594
+ }): Promise<import("./api/roi-analytics").BusinessImpact>;
595
+ industries(): Promise<import("./api/roi-analytics").IndustryConfig[]>;
596
+ correlations(options?: {
597
+ startDate?: string | Date;
598
+ endDate?: string | Date;
599
+ agentId?: string;
600
+ }): Promise<import("./api/roi-analytics").CorrelationAnalysis>;
601
+ };
602
+ qualityMetrics: {
603
+ getRagScores(traceId: string): Promise<{
604
+ traceId: string;
605
+ evaluation: import("./api/quality-metrics").RAGEvaluation;
606
+ evidence: import("./api/quality-metrics").RAGEvidence;
607
+ }>;
608
+ getHallucinationReport(traceId: string): Promise<{
609
+ traceId: string;
610
+ report: import("./api/quality-metrics").HallucinationReport;
611
+ }>;
612
+ evaluateRag(input: {
613
+ query: string;
614
+ response: string;
615
+ retrievedContexts: import("./api/quality-metrics").RetrievedContext[];
616
+ groundTruthContexts?: import("./api/quality-metrics").GroundTruthContext[];
617
+ citations?: string[];
618
+ }): Promise<{
619
+ evaluation: import("./api/quality-metrics").RAGEvaluation;
620
+ evidence: import("./api/quality-metrics").RAGEvidence;
621
+ }>;
622
+ detectHallucinations(input: {
623
+ response: string;
624
+ contexts: Array<{
625
+ content: string;
626
+ metadata?: Record<string, unknown>;
627
+ }>;
628
+ query?: string;
629
+ previousResponses?: string[];
630
+ }): Promise<{
631
+ report: import("./api/quality-metrics").HallucinationReport;
632
+ }>;
633
+ getGroundedness(traceId: string): Promise<{
634
+ traceId: string;
635
+ groundedness: import("./api/quality-metrics").GroundednessResult;
636
+ spans: {
637
+ grounded: Array<{
638
+ text: string;
639
+ confidence: number;
640
+ sourceIndex: number;
641
+ }>;
642
+ ungrounded: Array<{
643
+ text: string;
644
+ confidence: number;
645
+ }>;
646
+ };
647
+ summary: {
648
+ totalSpans: number;
649
+ groundedSpans: number;
650
+ ungroundedSpans: number;
651
+ groundednessRatio: number;
652
+ };
653
+ }>;
654
+ evaluateBatch(options: {
655
+ traceIds: string[];
656
+ includeDetails?: boolean;
657
+ }): Promise<{
658
+ summary: import("./api/quality-metrics").BatchEvaluationSummary;
659
+ results: import("./api/quality-metrics").BatchEvaluationResult[];
660
+ }>;
661
+ };
662
+ businessMetrics: {
663
+ current(agentId: string, metricName?: string): Promise<import("./api/business-metrics").CurrentMetricResponse>;
664
+ history(agentId: string, metricName: string, options?: {
665
+ startDate?: string | Date;
666
+ endDate?: string | Date;
667
+ granularity?: "hourly" | "daily" | "weekly" | "monthly";
668
+ }): Promise<import("./api/business-metrics").MetricHistoryResponse>;
669
+ record(agentId: string, options: import("./api/business-metrics").RecordMetricOptions): Promise<import("./api/business-metrics").RecordMetricResponse>;
670
+ recordBatch(agentId: string, metrics: import("./api/business-metrics").RecordMetricOptions[]): Promise<import("./api/business-metrics").RecordMetricResponse[]>;
329
671
  };
330
672
  generateZendeskMarker: typeof generateZendeskMarker;
331
673
  parseZendeskMarker: typeof parseZendeskMarker;
@@ -335,5 +677,16 @@ declare const _default: {
335
677
  isInference: typeof isInference;
336
678
  calculateBrierScore: typeof calculateBrierScore;
337
679
  isWellCalibrated: typeof isWellCalibrated;
680
+ calculatePassAtK: typeof calculatePassAtK;
681
+ isReliableEvaluation: typeof isReliableEvaluation;
682
+ isHighRisk: typeof isHighRisk;
683
+ needsAttention: typeof needsAttention;
684
+ calculateRevenueAtRisk: typeof calculateRevenueAtRisk;
685
+ formatCurrency: typeof formatCurrency;
686
+ passesQualityThreshold: typeof passesQualityThreshold;
687
+ isHallucinationRiskAcceptable: typeof isHallucinationRiskAcceptable;
688
+ isMetricReady: typeof isMetricReady;
689
+ needsMoreTraces: typeof needsMoreTraces;
690
+ getStatusMessage: typeof getStatusMessage;
338
691
  };
339
692
  export default _default;