@driftgard/node 1.5.1 → 1.6.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/README.md +15 -0
- package/dist/types.d.ts +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,6 +89,21 @@ const result = await dg.evaluate({
|
|
|
89
89
|
|
|
90
90
|
All fields in `usage` are optional. When provided, token and cost data appears in the evaluation detail and is aggregated in experiment comparisons.
|
|
91
91
|
|
|
92
|
+
## Cost alerts
|
|
93
|
+
|
|
94
|
+
When cost alerting is enabled on your project, the response includes a `cost_alert` field if a threshold is exceeded:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
const result = await dg.evaluate({ ... });
|
|
98
|
+
|
|
99
|
+
if (result.cost_alert) {
|
|
100
|
+
console.warn(`Cost alert: ${result.cost_alert.scope} spend $${result.cost_alert.actual_usd} exceeds $${result.cost_alert.threshold_usd}`);
|
|
101
|
+
// Throttle the agent, notify the user, etc.
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Configure thresholds in Settings — per-project, per-model, or per-session. Session-scoped alerts catch runaway agent loops in real-time.
|
|
106
|
+
|
|
92
107
|
## Features
|
|
93
108
|
|
|
94
109
|
- Single `evaluate()` method — send prompt/response, get verdict
|
package/dist/types.d.ts
CHANGED
|
@@ -103,4 +103,13 @@ export interface EvaluateResponse {
|
|
|
103
103
|
hitl?: HitlInfo;
|
|
104
104
|
evaluation: EvaluationResult;
|
|
105
105
|
fallback?: FallbackResponse;
|
|
106
|
+
cost_alert?: {
|
|
107
|
+
type: string;
|
|
108
|
+
scope: string;
|
|
109
|
+
session_id?: string;
|
|
110
|
+
model_id?: string;
|
|
111
|
+
window: string;
|
|
112
|
+
threshold_usd: number;
|
|
113
|
+
actual_usd: number;
|
|
114
|
+
};
|
|
106
115
|
}
|
package/package.json
CHANGED