wauldo 0.3.0 → 0.5.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 +114 -70
- package/dist/index.d.mts +1 -83
- package/dist/index.d.ts +1 -83
- package/dist/index.js +0 -47
- package/dist/index.mjs +0 -47
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,80 +1,129 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">Wauldo TypeScript SDK</h1>
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[](./LICENSE)
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>Verified AI answers from your documents — or no answer at all.</strong>
|
|
5
|
+
</p>
|
|
7
6
|
|
|
8
|
-
>
|
|
7
|
+
<p align="center">
|
|
8
|
+
Most RAG APIs guess. Wauldo verifies.
|
|
9
|
+
</p>
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
<p align="center">
|
|
12
|
+
<b>0% hallucination</b> | 83% accuracy | 61 eval tasks | 14 LLMs tested
|
|
13
|
+
</p>
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://npmjs.com/package/wauldo"><img src="https://img.shields.io/npm/v/wauldo.svg" alt="npm" /></a>
|
|
17
|
+
<a href="https://npmjs.com/package/wauldo"><img src="https://img.shields.io/npm/dm/wauldo.svg" alt="Downloads" /></a>
|
|
18
|
+
<img src="https://img.shields.io/badge/TypeScript-5.0+-blue.svg" alt="TypeScript" />
|
|
19
|
+
<img src="https://img.shields.io/badge/License-MIT-green.svg" alt="MIT" />
|
|
20
|
+
</p>
|
|
13
21
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
<p align="center">
|
|
23
|
+
<a href="https://wauldo.com/demo">Demo</a> •
|
|
24
|
+
<a href="https://wauldo.com/docs">Docs</a> •
|
|
25
|
+
<a href="https://rapidapi.com/binnewzzin/api/smart-rag-api">Free API Key</a> •
|
|
26
|
+
<a href="https://dev.to/wauldo/how-we-achieved-0-hallucination-rate-in-our-rag-api-with-benchmarks-4g54">Benchmarks</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Quickstart (30 seconds)
|
|
21
32
|
|
|
22
|
-
|
|
33
|
+
```bash
|
|
34
|
+
npm install wauldo
|
|
35
|
+
```
|
|
23
36
|
|
|
24
37
|
```typescript
|
|
25
38
|
import { HttpClient } from 'wauldo';
|
|
26
39
|
|
|
27
40
|
const client = new HttpClient({ baseUrl: 'https://api.wauldo.com', apiKey: 'YOUR_API_KEY' });
|
|
28
41
|
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
// Upload a document
|
|
43
|
+
await client.ragUpload('Our refund policy allows returns within 60 days...', 'policy.txt');
|
|
44
|
+
|
|
45
|
+
// Ask a question — answer is verified against the source
|
|
46
|
+
const result = await client.ragQuery('What is the refund policy?');
|
|
47
|
+
console.log(result.answer);
|
|
48
|
+
console.log(result.sources);
|
|
31
49
|
```
|
|
32
50
|
|
|
33
|
-
|
|
51
|
+
```
|
|
52
|
+
Output:
|
|
53
|
+
Answer: Returns are accepted within 60 days of purchase.
|
|
54
|
+
Sources: policy.txt — "Our refund policy allows returns within 60 days"
|
|
55
|
+
Grounded: true | Confidence: 0.92
|
|
56
|
+
```
|
|
34
57
|
|
|
35
|
-
|
|
36
|
-
|
|
58
|
+
[Try the demo](https://wauldo.com/demo) | [Get a free API key](https://rapidapi.com/binnewzzin/api/smart-rag-api)
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Why Wauldo (and not standard RAG)
|
|
63
|
+
|
|
64
|
+
**Typical RAG pipeline**
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
retrieve → generate → hope it's correct
|
|
37
68
|
```
|
|
38
69
|
|
|
39
|
-
**
|
|
70
|
+
**Wauldo pipeline**
|
|
40
71
|
|
|
41
|
-
|
|
72
|
+
```
|
|
73
|
+
retrieve → extract facts → generate → verify → return or refuse
|
|
74
|
+
```
|
|
42
75
|
|
|
43
|
-
|
|
76
|
+
If the answer can't be verified, it returns **"insufficient evidence"** instead of guessing.
|
|
44
77
|
|
|
45
|
-
|
|
46
|
-
import { HttpClient } from 'wauldo';
|
|
78
|
+
### See the difference
|
|
47
79
|
|
|
48
|
-
|
|
80
|
+
```
|
|
81
|
+
Document: "Refunds are processed within 60 days"
|
|
49
82
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
{ role: 'system', content: 'You are a helpful assistant.' },
|
|
54
|
-
{ role: 'user', content: 'Explain async/await in TypeScript' },
|
|
55
|
-
],
|
|
56
|
-
});
|
|
57
|
-
console.log(response.choices[0]?.message?.content);
|
|
83
|
+
Typical RAG: "Refunds are processed within 30 days" ← wrong
|
|
84
|
+
Wauldo: "Refunds are processed within 60 days" ← verified
|
|
85
|
+
or "insufficient evidence" if unclear ← safe
|
|
58
86
|
```
|
|
59
87
|
|
|
60
|
-
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Examples
|
|
91
|
+
|
|
92
|
+
### Upload a PDF and ask questions
|
|
61
93
|
|
|
62
94
|
```typescript
|
|
63
|
-
// Upload
|
|
64
|
-
const upload = await client.
|
|
65
|
-
console.log(`
|
|
95
|
+
// Upload — text extraction + quality scoring happens server-side
|
|
96
|
+
const upload = await client.uploadFile(filePath, { title: 'Q3 Contract' });
|
|
97
|
+
console.log(`Extracted ${upload.chunks_count} chunks, quality: ${upload.quality_label}`);
|
|
66
98
|
|
|
67
|
-
// Query
|
|
99
|
+
// Query
|
|
68
100
|
const result = await client.ragQuery('What are the payment terms?');
|
|
69
101
|
console.log(`Answer: ${result.answer}`);
|
|
70
102
|
console.log(`Confidence: ${Math.round(result.audit.confidence * 100)}%`);
|
|
71
103
|
console.log(`Grounded: ${result.audit.grounded}`);
|
|
72
|
-
for (const source of result.sources) {
|
|
73
|
-
console.log(` Source (${Math.round(source.score * 100)}%): ${source.content}`);
|
|
74
|
-
}
|
|
75
104
|
```
|
|
76
105
|
|
|
77
|
-
###
|
|
106
|
+
### Fact-check any LLM output
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
const result = await client.factCheck({
|
|
110
|
+
text: 'Returns are accepted within 60 days.',
|
|
111
|
+
sourceContext: 'Our policy allows returns within 14 days.',
|
|
112
|
+
mode: 'lexical',
|
|
113
|
+
});
|
|
114
|
+
console.log(result.verdict); // "rejected"
|
|
115
|
+
console.log(result.action); // "block"
|
|
116
|
+
console.log(result.claims[0].reason); // "numerical_mismatch"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Chat (OpenAI-compatible)
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
const reply = await client.chatSimple('auto', 'Explain async/await in TypeScript');
|
|
123
|
+
console.log(reply);
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Streaming
|
|
78
127
|
|
|
79
128
|
```typescript
|
|
80
129
|
const stream = client.chatStream({
|
|
@@ -86,7 +135,7 @@ for await (const chunk of stream) {
|
|
|
86
135
|
}
|
|
87
136
|
```
|
|
88
137
|
|
|
89
|
-
### Conversation
|
|
138
|
+
### Conversation
|
|
90
139
|
|
|
91
140
|
```typescript
|
|
92
141
|
const conv = client.conversation({ system: 'You are an expert on TypeScript.', model: 'auto' });
|
|
@@ -94,18 +143,20 @@ const reply = await conv.say('What are generics?');
|
|
|
94
143
|
const followUp = await conv.say('Give me an example');
|
|
95
144
|
```
|
|
96
145
|
|
|
97
|
-
|
|
146
|
+
---
|
|
98
147
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
148
|
+
## Features
|
|
149
|
+
|
|
150
|
+
- **Pre-generation fact extraction** — numbers, dates, limits injected as constraints
|
|
151
|
+
- **Post-generation grounding check** — every answer verified against sources
|
|
152
|
+
- **Citation validation** — detects phantom references
|
|
153
|
+
- **Fact-check API** — verify any claim against any source (3 modes)
|
|
154
|
+
- **Native PDF/DOCX upload** — server-side extraction with quality scoring
|
|
155
|
+
- **Smart model routing** — auto-selects cheapest model that meets quality
|
|
156
|
+
- **OpenAI-compatible** — swap your `baseUrl`, keep your existing code
|
|
157
|
+
- **Zero dependencies** — uses Node 18+ built-in APIs (fetch, ReadableStream)
|
|
158
|
+
|
|
159
|
+
---
|
|
109
160
|
|
|
110
161
|
## Error Handling
|
|
111
162
|
|
|
@@ -113,19 +164,16 @@ result.claims.forEach(c => console.log(`${c.text} → ${c.verdict} (${c.reason})
|
|
|
113
164
|
import { HttpClient, ServerError } from 'wauldo';
|
|
114
165
|
|
|
115
166
|
try {
|
|
116
|
-
const response = await client.chat({
|
|
117
|
-
model: 'auto',
|
|
118
|
-
messages: [{ role: 'user', content: 'Hello' }],
|
|
119
|
-
});
|
|
167
|
+
const response = await client.chat({ model: 'auto', messages: [{ role: 'user', content: 'Hello' }] });
|
|
120
168
|
} catch (error) {
|
|
121
169
|
if (error instanceof ServerError) {
|
|
122
170
|
console.error(`Server error [${error.code}]: ${error.message}`);
|
|
123
|
-
} else {
|
|
124
|
-
console.error('Unknown error:', error);
|
|
125
171
|
}
|
|
126
172
|
}
|
|
127
173
|
```
|
|
128
174
|
|
|
175
|
+
---
|
|
176
|
+
|
|
129
177
|
## RapidAPI
|
|
130
178
|
|
|
131
179
|
```typescript
|
|
@@ -138,19 +186,15 @@ const client = new HttpClient({
|
|
|
138
186
|
});
|
|
139
187
|
```
|
|
140
188
|
|
|
141
|
-
|
|
189
|
+
Free tier (300 req/month): [RapidAPI](https://rapidapi.com/binnewzzin/api/smart-rag-api)
|
|
142
190
|
|
|
143
|
-
|
|
191
|
+
---
|
|
144
192
|
|
|
145
|
-
|
|
146
|
-
- [Documentation](https://wauldo.com/docs)
|
|
147
|
-
- [Live Demo](https://api.wauldo.com/demo)
|
|
148
|
-
- [Cost Calculator](https://wauldo.com/calculator)
|
|
149
|
-
- [Status](https://wauldo.com/status)
|
|
193
|
+
[Website](https://wauldo.com) | [Docs](https://wauldo.com/docs) | [Demo](https://wauldo.com/demo) | [Benchmarks](https://dev.to/wauldo/how-we-achieved-0-hallucination-rate-in-our-rag-api-with-benchmarks-4g54)
|
|
150
194
|
|
|
151
195
|
## Contributing
|
|
152
196
|
|
|
153
|
-
|
|
197
|
+
PRs welcome. Check the [good first issues](https://github.com/wauldo/wauldo-sdk-js/labels/good%20first%20issue).
|
|
154
198
|
|
|
155
199
|
## License
|
|
156
200
|
|
package/dist/index.d.mts
CHANGED
|
@@ -312,58 +312,6 @@ interface RagQueryResponse {
|
|
|
312
312
|
interface OrchestratorResponse {
|
|
313
313
|
final_output: string;
|
|
314
314
|
}
|
|
315
|
-
interface FactCheckRequest {
|
|
316
|
-
text: string;
|
|
317
|
-
source_context: string;
|
|
318
|
-
mode?: 'lexical' | 'hybrid' | 'semantic';
|
|
319
|
-
}
|
|
320
|
-
interface ClaimResult {
|
|
321
|
-
text: string;
|
|
322
|
-
claim_type: string;
|
|
323
|
-
supported: boolean;
|
|
324
|
-
confidence: number;
|
|
325
|
-
confidence_label: string;
|
|
326
|
-
verdict: string;
|
|
327
|
-
action: string;
|
|
328
|
-
reason?: string | null;
|
|
329
|
-
evidence?: string | null;
|
|
330
|
-
}
|
|
331
|
-
interface FactCheckResponse {
|
|
332
|
-
verdict: string;
|
|
333
|
-
action: string;
|
|
334
|
-
hallucination_rate: number;
|
|
335
|
-
mode: string;
|
|
336
|
-
total_claims: number;
|
|
337
|
-
supported_claims: number;
|
|
338
|
-
confidence: number;
|
|
339
|
-
claims: ClaimResult[];
|
|
340
|
-
mode_warning?: string | null;
|
|
341
|
-
processing_time_ms: number;
|
|
342
|
-
}
|
|
343
|
-
interface SourceChunk {
|
|
344
|
-
name: string;
|
|
345
|
-
content: string;
|
|
346
|
-
}
|
|
347
|
-
interface CitationDetail {
|
|
348
|
-
citation: string;
|
|
349
|
-
source_name: string;
|
|
350
|
-
is_valid: boolean;
|
|
351
|
-
}
|
|
352
|
-
interface VerifyCitationRequest {
|
|
353
|
-
text: string;
|
|
354
|
-
sources?: SourceChunk[];
|
|
355
|
-
threshold?: number;
|
|
356
|
-
}
|
|
357
|
-
interface VerifyCitationResponse {
|
|
358
|
-
citation_ratio: number;
|
|
359
|
-
has_sufficient_citations: boolean;
|
|
360
|
-
sentence_count: number;
|
|
361
|
-
citation_count: number;
|
|
362
|
-
uncited_sentences: string[];
|
|
363
|
-
citations?: CitationDetail[];
|
|
364
|
-
phantom_count?: number;
|
|
365
|
-
processing_time_ms: number;
|
|
366
|
-
}
|
|
367
315
|
/** Minimal interface required by Conversation — implemented by both HttpClient and MockHttpClient */
|
|
368
316
|
interface ChatClientLike {
|
|
369
317
|
chat(request: ChatRequest, options?: RequestOptions): Promise<ChatResponse>;
|
|
@@ -521,36 +469,6 @@ declare class HttpClient {
|
|
|
521
469
|
orchestrate(prompt: string): Promise<OrchestratorResponse>;
|
|
522
470
|
/** POST /v1/orchestrator/parallel — Run all 4 specialists in parallel */
|
|
523
471
|
orchestrateParallel(prompt: string): Promise<OrchestratorResponse>;
|
|
524
|
-
/**
|
|
525
|
-
* POST /v1/fact-check — Verify claims against source context.
|
|
526
|
-
*
|
|
527
|
-
* @param request - Text and source context to verify
|
|
528
|
-
* @returns FactCheckResponse with verdict, action, and per-claim results
|
|
529
|
-
*
|
|
530
|
-
* @example
|
|
531
|
-
* ```typescript
|
|
532
|
-
* const result = await client.factCheck({
|
|
533
|
-
* text: 'Returns accepted within 60 days.',
|
|
534
|
-
* source_context: 'Our policy allows returns within 14 days.',
|
|
535
|
-
* mode: 'lexical',
|
|
536
|
-
* });
|
|
537
|
-
* console.log(result.verdict); // "rejected"
|
|
538
|
-
* ```
|
|
539
|
-
*/
|
|
540
|
-
factCheck(request: FactCheckRequest): Promise<FactCheckResponse>;
|
|
541
|
-
/**
|
|
542
|
-
* POST /v1/verify — Verify citations in AI-generated text.
|
|
543
|
-
*
|
|
544
|
-
* @example
|
|
545
|
-
* ```ts
|
|
546
|
-
* const result = await client.verifyCitation({
|
|
547
|
-
* text: 'Rust was released in 2010 [Source: rust_book].',
|
|
548
|
-
* sources: [{ name: 'rust_book', content: 'Rust was first released in 2010.' }],
|
|
549
|
-
* });
|
|
550
|
-
* console.log(result.phantom_count); // 0
|
|
551
|
-
* ```
|
|
552
|
-
*/
|
|
553
|
-
verifyCitation(request: VerifyCitationRequest): Promise<VerifyCitationResponse>;
|
|
554
472
|
}
|
|
555
473
|
|
|
556
474
|
/**
|
|
@@ -671,4 +589,4 @@ declare class ToolNotFoundError extends WauldoError {
|
|
|
671
589
|
constructor(toolName: string);
|
|
672
590
|
}
|
|
673
591
|
|
|
674
|
-
export { AgentClient, type CallToolResponse, type ChatChoice, type ChatClientLike, type ChatMessage, type ChatRequest, type ChatResponse, type ChatUsage, type Chunk, type ChunkResult, type
|
|
592
|
+
export { AgentClient, type CallToolResponse, type ChatChoice, type ChatClientLike, type ChatMessage, type ChatRequest, type ChatResponse, type ChatUsage, type Chunk, type ChunkResult, type ClientOptions, type Concept, type ConceptResult, ConnectionError, Conversation, type DetailLevel, type EmbeddingData, type EmbeddingResponse, type EmbeddingUsage, type GraphNode, HttpClient, type HttpClientConfig, type KnowledgeGraphResult, type LogLevel, MockHttpClient, type ModelInfo, type ModelList, type OrchestratorResponse, type PlanOptions, type PlanResult, type PlanStep, type RagAuditInfo, type RagQueryResponse, type RagSource, type RagUploadResponse, type ReasoningOptions, type ReasoningResult, type RequestOptions, type RetrievalResult, ServerError, type SourceType, TimeoutError, type ToolContent, type ToolDefinition, ToolNotFoundError, ValidationError, WauldoError, chatContent };
|
package/dist/index.d.ts
CHANGED
|
@@ -312,58 +312,6 @@ interface RagQueryResponse {
|
|
|
312
312
|
interface OrchestratorResponse {
|
|
313
313
|
final_output: string;
|
|
314
314
|
}
|
|
315
|
-
interface FactCheckRequest {
|
|
316
|
-
text: string;
|
|
317
|
-
source_context: string;
|
|
318
|
-
mode?: 'lexical' | 'hybrid' | 'semantic';
|
|
319
|
-
}
|
|
320
|
-
interface ClaimResult {
|
|
321
|
-
text: string;
|
|
322
|
-
claim_type: string;
|
|
323
|
-
supported: boolean;
|
|
324
|
-
confidence: number;
|
|
325
|
-
confidence_label: string;
|
|
326
|
-
verdict: string;
|
|
327
|
-
action: string;
|
|
328
|
-
reason?: string | null;
|
|
329
|
-
evidence?: string | null;
|
|
330
|
-
}
|
|
331
|
-
interface FactCheckResponse {
|
|
332
|
-
verdict: string;
|
|
333
|
-
action: string;
|
|
334
|
-
hallucination_rate: number;
|
|
335
|
-
mode: string;
|
|
336
|
-
total_claims: number;
|
|
337
|
-
supported_claims: number;
|
|
338
|
-
confidence: number;
|
|
339
|
-
claims: ClaimResult[];
|
|
340
|
-
mode_warning?: string | null;
|
|
341
|
-
processing_time_ms: number;
|
|
342
|
-
}
|
|
343
|
-
interface SourceChunk {
|
|
344
|
-
name: string;
|
|
345
|
-
content: string;
|
|
346
|
-
}
|
|
347
|
-
interface CitationDetail {
|
|
348
|
-
citation: string;
|
|
349
|
-
source_name: string;
|
|
350
|
-
is_valid: boolean;
|
|
351
|
-
}
|
|
352
|
-
interface VerifyCitationRequest {
|
|
353
|
-
text: string;
|
|
354
|
-
sources?: SourceChunk[];
|
|
355
|
-
threshold?: number;
|
|
356
|
-
}
|
|
357
|
-
interface VerifyCitationResponse {
|
|
358
|
-
citation_ratio: number;
|
|
359
|
-
has_sufficient_citations: boolean;
|
|
360
|
-
sentence_count: number;
|
|
361
|
-
citation_count: number;
|
|
362
|
-
uncited_sentences: string[];
|
|
363
|
-
citations?: CitationDetail[];
|
|
364
|
-
phantom_count?: number;
|
|
365
|
-
processing_time_ms: number;
|
|
366
|
-
}
|
|
367
315
|
/** Minimal interface required by Conversation — implemented by both HttpClient and MockHttpClient */
|
|
368
316
|
interface ChatClientLike {
|
|
369
317
|
chat(request: ChatRequest, options?: RequestOptions): Promise<ChatResponse>;
|
|
@@ -521,36 +469,6 @@ declare class HttpClient {
|
|
|
521
469
|
orchestrate(prompt: string): Promise<OrchestratorResponse>;
|
|
522
470
|
/** POST /v1/orchestrator/parallel — Run all 4 specialists in parallel */
|
|
523
471
|
orchestrateParallel(prompt: string): Promise<OrchestratorResponse>;
|
|
524
|
-
/**
|
|
525
|
-
* POST /v1/fact-check — Verify claims against source context.
|
|
526
|
-
*
|
|
527
|
-
* @param request - Text and source context to verify
|
|
528
|
-
* @returns FactCheckResponse with verdict, action, and per-claim results
|
|
529
|
-
*
|
|
530
|
-
* @example
|
|
531
|
-
* ```typescript
|
|
532
|
-
* const result = await client.factCheck({
|
|
533
|
-
* text: 'Returns accepted within 60 days.',
|
|
534
|
-
* source_context: 'Our policy allows returns within 14 days.',
|
|
535
|
-
* mode: 'lexical',
|
|
536
|
-
* });
|
|
537
|
-
* console.log(result.verdict); // "rejected"
|
|
538
|
-
* ```
|
|
539
|
-
*/
|
|
540
|
-
factCheck(request: FactCheckRequest): Promise<FactCheckResponse>;
|
|
541
|
-
/**
|
|
542
|
-
* POST /v1/verify — Verify citations in AI-generated text.
|
|
543
|
-
*
|
|
544
|
-
* @example
|
|
545
|
-
* ```ts
|
|
546
|
-
* const result = await client.verifyCitation({
|
|
547
|
-
* text: 'Rust was released in 2010 [Source: rust_book].',
|
|
548
|
-
* sources: [{ name: 'rust_book', content: 'Rust was first released in 2010.' }],
|
|
549
|
-
* });
|
|
550
|
-
* console.log(result.phantom_count); // 0
|
|
551
|
-
* ```
|
|
552
|
-
*/
|
|
553
|
-
verifyCitation(request: VerifyCitationRequest): Promise<VerifyCitationResponse>;
|
|
554
472
|
}
|
|
555
473
|
|
|
556
474
|
/**
|
|
@@ -671,4 +589,4 @@ declare class ToolNotFoundError extends WauldoError {
|
|
|
671
589
|
constructor(toolName: string);
|
|
672
590
|
}
|
|
673
591
|
|
|
674
|
-
export { AgentClient, type CallToolResponse, type ChatChoice, type ChatClientLike, type ChatMessage, type ChatRequest, type ChatResponse, type ChatUsage, type Chunk, type ChunkResult, type
|
|
592
|
+
export { AgentClient, type CallToolResponse, type ChatChoice, type ChatClientLike, type ChatMessage, type ChatRequest, type ChatResponse, type ChatUsage, type Chunk, type ChunkResult, type ClientOptions, type Concept, type ConceptResult, ConnectionError, Conversation, type DetailLevel, type EmbeddingData, type EmbeddingResponse, type EmbeddingUsage, type GraphNode, HttpClient, type HttpClientConfig, type KnowledgeGraphResult, type LogLevel, MockHttpClient, type ModelInfo, type ModelList, type OrchestratorResponse, type PlanOptions, type PlanResult, type PlanStep, type RagAuditInfo, type RagQueryResponse, type RagSource, type RagUploadResponse, type ReasoningOptions, type ReasoningResult, type RequestOptions, type RetrievalResult, ServerError, type SourceType, TimeoutError, type ToolContent, type ToolDefinition, ToolNotFoundError, ValidationError, WauldoError, chatContent };
|
package/dist/index.js
CHANGED
|
@@ -1097,53 +1097,6 @@ var HttpClient = class {
|
|
|
1097
1097
|
);
|
|
1098
1098
|
return validateResponse(data, "OrchestratorResponse");
|
|
1099
1099
|
}
|
|
1100
|
-
// ── Fact-Check endpoints ──────────────────────────────────────────────
|
|
1101
|
-
/**
|
|
1102
|
-
* POST /v1/fact-check — Verify claims against source context.
|
|
1103
|
-
*
|
|
1104
|
-
* @param request - Text and source context to verify
|
|
1105
|
-
* @returns FactCheckResponse with verdict, action, and per-claim results
|
|
1106
|
-
*
|
|
1107
|
-
* @example
|
|
1108
|
-
* ```typescript
|
|
1109
|
-
* const result = await client.factCheck({
|
|
1110
|
-
* text: 'Returns accepted within 60 days.',
|
|
1111
|
-
* source_context: 'Our policy allows returns within 14 days.',
|
|
1112
|
-
* mode: 'lexical',
|
|
1113
|
-
* });
|
|
1114
|
-
* console.log(result.verdict); // "rejected"
|
|
1115
|
-
* ```
|
|
1116
|
-
*/
|
|
1117
|
-
async factCheck(request) {
|
|
1118
|
-
const data = await fetchWithRetry(
|
|
1119
|
-
this.retryConfig,
|
|
1120
|
-
"POST",
|
|
1121
|
-
"/v1/fact-check",
|
|
1122
|
-
request
|
|
1123
|
-
);
|
|
1124
|
-
return validateResponse(data, "FactCheckResponse");
|
|
1125
|
-
}
|
|
1126
|
-
/**
|
|
1127
|
-
* POST /v1/verify — Verify citations in AI-generated text.
|
|
1128
|
-
*
|
|
1129
|
-
* @example
|
|
1130
|
-
* ```ts
|
|
1131
|
-
* const result = await client.verifyCitation({
|
|
1132
|
-
* text: 'Rust was released in 2010 [Source: rust_book].',
|
|
1133
|
-
* sources: [{ name: 'rust_book', content: 'Rust was first released in 2010.' }],
|
|
1134
|
-
* });
|
|
1135
|
-
* console.log(result.phantom_count); // 0
|
|
1136
|
-
* ```
|
|
1137
|
-
*/
|
|
1138
|
-
async verifyCitation(request) {
|
|
1139
|
-
const data = await fetchWithRetry(
|
|
1140
|
-
this.retryConfig,
|
|
1141
|
-
"POST",
|
|
1142
|
-
"/v1/verify",
|
|
1143
|
-
request
|
|
1144
|
-
);
|
|
1145
|
-
return validateResponse(data, "VerifyCitationResponse");
|
|
1146
|
-
}
|
|
1147
1100
|
};
|
|
1148
1101
|
|
|
1149
1102
|
// src/mock_client.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1061,53 +1061,6 @@ var HttpClient = class {
|
|
|
1061
1061
|
);
|
|
1062
1062
|
return validateResponse(data, "OrchestratorResponse");
|
|
1063
1063
|
}
|
|
1064
|
-
// ── Fact-Check endpoints ──────────────────────────────────────────────
|
|
1065
|
-
/**
|
|
1066
|
-
* POST /v1/fact-check — Verify claims against source context.
|
|
1067
|
-
*
|
|
1068
|
-
* @param request - Text and source context to verify
|
|
1069
|
-
* @returns FactCheckResponse with verdict, action, and per-claim results
|
|
1070
|
-
*
|
|
1071
|
-
* @example
|
|
1072
|
-
* ```typescript
|
|
1073
|
-
* const result = await client.factCheck({
|
|
1074
|
-
* text: 'Returns accepted within 60 days.',
|
|
1075
|
-
* source_context: 'Our policy allows returns within 14 days.',
|
|
1076
|
-
* mode: 'lexical',
|
|
1077
|
-
* });
|
|
1078
|
-
* console.log(result.verdict); // "rejected"
|
|
1079
|
-
* ```
|
|
1080
|
-
*/
|
|
1081
|
-
async factCheck(request) {
|
|
1082
|
-
const data = await fetchWithRetry(
|
|
1083
|
-
this.retryConfig,
|
|
1084
|
-
"POST",
|
|
1085
|
-
"/v1/fact-check",
|
|
1086
|
-
request
|
|
1087
|
-
);
|
|
1088
|
-
return validateResponse(data, "FactCheckResponse");
|
|
1089
|
-
}
|
|
1090
|
-
/**
|
|
1091
|
-
* POST /v1/verify — Verify citations in AI-generated text.
|
|
1092
|
-
*
|
|
1093
|
-
* @example
|
|
1094
|
-
* ```ts
|
|
1095
|
-
* const result = await client.verifyCitation({
|
|
1096
|
-
* text: 'Rust was released in 2010 [Source: rust_book].',
|
|
1097
|
-
* sources: [{ name: 'rust_book', content: 'Rust was first released in 2010.' }],
|
|
1098
|
-
* });
|
|
1099
|
-
* console.log(result.phantom_count); // 0
|
|
1100
|
-
* ```
|
|
1101
|
-
*/
|
|
1102
|
-
async verifyCitation(request) {
|
|
1103
|
-
const data = await fetchWithRetry(
|
|
1104
|
-
this.retryConfig,
|
|
1105
|
-
"POST",
|
|
1106
|
-
"/v1/verify",
|
|
1107
|
-
request
|
|
1108
|
-
);
|
|
1109
|
-
return validateResponse(data, "VerifyCitationResponse");
|
|
1110
|
-
}
|
|
1111
1064
|
};
|
|
1112
1065
|
|
|
1113
1066
|
// src/mock_client.ts
|