truthguard-ai 0.1.5 → 0.2.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 +13 -13
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Most "hallucinations" in tool-calling agents are **grounding failures** — the
|
|
|
18
18
|
TruthGuard extracts factual claims from the agent's response, cross-references them against tool outputs, and reports grounding failures with standardized codes — like OBD diagnostic codes for AI.
|
|
19
19
|
|
|
20
20
|
```
|
|
21
|
-
npm install truthguard
|
|
21
|
+
npm install truthguard-ai
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
**Zero LLM calls.** 30+ deterministic failure detectors. Runs in <50ms.
|
|
@@ -30,7 +30,7 @@ npm install truthguard
|
|
|
30
30
|
### 1. Evaluate a trace
|
|
31
31
|
|
|
32
32
|
```typescript
|
|
33
|
-
import { TraceBuilder, GroundingEngine, generateReport } from 'truthguard';
|
|
33
|
+
import { TraceBuilder, GroundingEngine, generateReport } from 'truthguard-ai';
|
|
34
34
|
|
|
35
35
|
const trace = new TraceBuilder({ traceId: 'run-001' })
|
|
36
36
|
.addUserInput('How many employees are on leave today?')
|
|
@@ -55,7 +55,7 @@ console.log(text);
|
|
|
55
55
|
### 2. Add a CI quality gate
|
|
56
56
|
|
|
57
57
|
```typescript
|
|
58
|
-
import { loadDataset, runDataset, evaluateGate, loadGateConfig } from 'truthguard';
|
|
58
|
+
import { loadDataset, runDataset, evaluateGate, loadGateConfig } from 'truthguard-ai';
|
|
59
59
|
|
|
60
60
|
const entries = loadDataset('./test-cases.jsonl');
|
|
61
61
|
const result = runDataset(entries);
|
|
@@ -73,7 +73,7 @@ if (!verdict.pass) {
|
|
|
73
73
|
Works with **any language** — PHP, Python, Go, Java, Ruby, C#:
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
npx truthguard observe --port 3001
|
|
76
|
+
npx truthguard-ai observe --port 3001
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
Change your AI base URL:
|
|
@@ -112,7 +112,7 @@ Every detected failure includes actionable diagnostics — root cause identifica
|
|
|
112
112
|
Configure per-failure actions — block, warn, or observe:
|
|
113
113
|
|
|
114
114
|
```typescript
|
|
115
|
-
import { wrapOpenAI, GroundingError } from 'truthguard';
|
|
115
|
+
import { wrapOpenAI, GroundingError } from 'truthguard-ai';
|
|
116
116
|
import OpenAI from 'openai';
|
|
117
117
|
|
|
118
118
|
const openai = wrapOpenAI(new OpenAI(), {
|
|
@@ -131,7 +131,7 @@ const openai = wrapOpenAI(new OpenAI(), {
|
|
|
131
131
|
### Baseline Regression Detection
|
|
132
132
|
|
|
133
133
|
```typescript
|
|
134
|
-
import { createSnapshot, saveBaseline, loadBaseline, compareToBaseline } from 'truthguard';
|
|
134
|
+
import { createSnapshot, saveBaseline, loadBaseline, compareToBaseline } from 'truthguard-ai';
|
|
135
135
|
|
|
136
136
|
// Save after a known-good run
|
|
137
137
|
const snapshot = createSnapshot(result, 'v1.2-main');
|
|
@@ -158,7 +158,7 @@ Use TruthGuard directly from your IDE — no terminal needed.
|
|
|
158
158
|
"truthguard": {
|
|
159
159
|
"type": "stdio",
|
|
160
160
|
"command": "npx",
|
|
161
|
-
"args": ["-y", "truthguard", "mcp"]
|
|
161
|
+
"args": ["-y", "truthguard-ai", "mcp"]
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
}
|
|
@@ -178,7 +178,7 @@ Full setup guide: [docs/getting-started.md](docs/getting-started.md#ide--mcp-ser
|
|
|
178
178
|
|
|
179
179
|
```typescript
|
|
180
180
|
import express from 'express';
|
|
181
|
-
import { groundingMiddleware, FileStore } from 'truthguard';
|
|
181
|
+
import { groundingMiddleware, FileStore } from 'truthguard-ai';
|
|
182
182
|
|
|
183
183
|
const app = express();
|
|
184
184
|
app.post('/api/chat', groundingMiddleware({
|
|
@@ -193,10 +193,10 @@ app.post('/api/chat', groundingMiddleware({
|
|
|
193
193
|
## CLI
|
|
194
194
|
|
|
195
195
|
```bash
|
|
196
|
-
npx truthguard debug trace.json # Evaluate one trace
|
|
197
|
-
npx truthguard run dataset.jsonl # Batch dataset evaluation
|
|
198
|
-
npx truthguard run dataset.jsonl --gate gate.yml # CI quality gate
|
|
199
|
-
npx truthguard observe --port 3001 # Start observe server + proxy
|
|
196
|
+
npx truthguard-ai debug trace.json # Evaluate one trace
|
|
197
|
+
npx truthguard-ai run dataset.jsonl # Batch dataset evaluation
|
|
198
|
+
npx truthguard-ai run dataset.jsonl --gate gate.yml # CI quality gate
|
|
199
|
+
npx truthguard-ai observe --port 3001 # Start observe server + proxy
|
|
200
200
|
```
|
|
201
201
|
|
|
202
202
|
---
|
|
@@ -219,7 +219,7 @@ jobs:
|
|
|
219
219
|
with:
|
|
220
220
|
node-version: '20'
|
|
221
221
|
- run: npm ci
|
|
222
|
-
- run: npx truthguard run test-cases.jsonl --gate .ai-rcp-gate.yml
|
|
222
|
+
- run: npx truthguard-ai run test-cases.jsonl --gate .ai-rcp-gate.yml
|
|
223
223
|
```
|
|
224
224
|
|
|
225
225
|
### Gate config (`.ai-rcp-gate.yml`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "truthguard-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "TruthGuard — Standardized grounding validation for tool-calling AI agents. Detect, diagnose, and prevent grounding failures.",
|
|
5
5
|
"main": "dist-npm/thin.js",
|
|
6
6
|
"types": "dist-npm/thin.d.ts",
|
|
@@ -77,10 +77,13 @@
|
|
|
77
77
|
"@types/node": "^20.12.7",
|
|
78
78
|
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
|
79
79
|
"@typescript-eslint/parser": "^7.7.1",
|
|
80
|
+
"bcryptjs": "^3.0.3",
|
|
80
81
|
"cors": "^2.8.6",
|
|
81
82
|
"eslint": "^8.57.0",
|
|
82
83
|
"express": "^5.2.1",
|
|
83
84
|
"jest": "^29.7.0",
|
|
85
|
+
"js-yaml": "^4.1.1",
|
|
86
|
+
"jsonwebtoken": "^9.0.3",
|
|
84
87
|
"ts-jest": "^29.1.2",
|
|
85
88
|
"typescript": "^5.4.5"
|
|
86
89
|
},
|
|
@@ -98,11 +101,6 @@
|
|
|
98
101
|
"!src/index.ts"
|
|
99
102
|
]
|
|
100
103
|
},
|
|
101
|
-
"dependencies": {
|
|
102
|
-
"bcryptjs": "^3.0.3",
|
|
103
|
-
"js-yaml": "^4.1.1",
|
|
104
|
-
"jsonwebtoken": "^9.0.3"
|
|
105
|
-
},
|
|
106
104
|
"peerDependencies": {
|
|
107
105
|
"express": ">=4.0.0"
|
|
108
106
|
},
|