wauldo 0.1.1 → 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 +15 -1
- package/dist/index.d.mts +46 -1
- package/dist/index.d.ts +46 -1
- package/dist/index.js +26 -0
- package/dist/index.mjs +26 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
> **Verified AI answers from your documents.** Every response includes source citations, confidence scores, and an audit trail — or we don't answer at all.
|
|
9
9
|
|
|
10
|
-
Official TypeScript SDK for the [Wauldo API](https://wauldo.com) — the AI inference layer with smart model routing and
|
|
10
|
+
Official TypeScript SDK for the [Wauldo API](https://wauldo.com) — the AI inference layer with smart model routing, zero hallucinations, and standalone fact-checking.
|
|
11
11
|
|
|
12
12
|
## Why Wauldo?
|
|
13
13
|
|
|
14
|
+
- **Fact-Check API** — verify any claim against source context, get verdict (verified/weak/rejected), action (allow/review/block), and structured reason
|
|
14
15
|
- **Zero hallucinations** — every answer is verified against source documents
|
|
15
16
|
- **Smart model routing** — auto-selects the cheapest model that meets quality (save 40-80% on AI costs)
|
|
16
17
|
- **One API, 7+ providers** — OpenAI, Anthropic, Google, Qwen, Meta, Mistral, DeepSeek with automatic fallback
|
|
@@ -93,6 +94,19 @@ const reply = await conv.say('What are generics?');
|
|
|
93
94
|
const followUp = await conv.say('Give me an example');
|
|
94
95
|
```
|
|
95
96
|
|
|
97
|
+
### Fact-Check — Verify Claims
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
const result = await client.factCheck({
|
|
101
|
+
text: 'Returns are accepted within 60 days.',
|
|
102
|
+
source_context: 'Our policy allows returns within 14 days.',
|
|
103
|
+
mode: 'lexical',
|
|
104
|
+
});
|
|
105
|
+
console.log(result.verdict); // "rejected"
|
|
106
|
+
console.log(result.action); // "block"
|
|
107
|
+
result.claims.forEach(c => console.log(`${c.text} → ${c.verdict} (${c.reason})`));
|
|
108
|
+
```
|
|
109
|
+
|
|
96
110
|
## Error Handling
|
|
97
111
|
|
|
98
112
|
```typescript
|
package/dist/index.d.mts
CHANGED
|
@@ -312,6 +312,34 @@ 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
|
+
}
|
|
315
343
|
/** Minimal interface required by Conversation — implemented by both HttpClient and MockHttpClient */
|
|
316
344
|
interface ChatClientLike {
|
|
317
345
|
chat(request: ChatRequest, options?: RequestOptions): Promise<ChatResponse>;
|
|
@@ -469,6 +497,23 @@ declare class HttpClient {
|
|
|
469
497
|
orchestrate(prompt: string): Promise<OrchestratorResponse>;
|
|
470
498
|
/** POST /v1/orchestrator/parallel — Run all 4 specialists in parallel */
|
|
471
499
|
orchestrateParallel(prompt: string): Promise<OrchestratorResponse>;
|
|
500
|
+
/**
|
|
501
|
+
* POST /v1/fact-check — Verify claims against source context.
|
|
502
|
+
*
|
|
503
|
+
* @param request - Text and source context to verify
|
|
504
|
+
* @returns FactCheckResponse with verdict, action, and per-claim results
|
|
505
|
+
*
|
|
506
|
+
* @example
|
|
507
|
+
* ```typescript
|
|
508
|
+
* const result = await client.factCheck({
|
|
509
|
+
* text: 'Returns accepted within 60 days.',
|
|
510
|
+
* source_context: 'Our policy allows returns within 14 days.',
|
|
511
|
+
* mode: 'lexical',
|
|
512
|
+
* });
|
|
513
|
+
* console.log(result.verdict); // "rejected"
|
|
514
|
+
* ```
|
|
515
|
+
*/
|
|
516
|
+
factCheck(request: FactCheckRequest): Promise<FactCheckResponse>;
|
|
472
517
|
}
|
|
473
518
|
|
|
474
519
|
/**
|
|
@@ -589,4 +634,4 @@ declare class ToolNotFoundError extends WauldoError {
|
|
|
589
634
|
constructor(toolName: string);
|
|
590
635
|
}
|
|
591
636
|
|
|
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 };
|
|
637
|
+
export { AgentClient, type CallToolResponse, type ChatChoice, type ChatClientLike, type ChatMessage, type ChatRequest, type ChatResponse, type ChatUsage, type Chunk, type ChunkResult, type ClaimResult, type ClientOptions, type Concept, type ConceptResult, ConnectionError, Conversation, type DetailLevel, type EmbeddingData, type EmbeddingResponse, type EmbeddingUsage, type FactCheckRequest, type FactCheckResponse, 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,6 +312,34 @@ 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
|
+
}
|
|
315
343
|
/** Minimal interface required by Conversation — implemented by both HttpClient and MockHttpClient */
|
|
316
344
|
interface ChatClientLike {
|
|
317
345
|
chat(request: ChatRequest, options?: RequestOptions): Promise<ChatResponse>;
|
|
@@ -469,6 +497,23 @@ declare class HttpClient {
|
|
|
469
497
|
orchestrate(prompt: string): Promise<OrchestratorResponse>;
|
|
470
498
|
/** POST /v1/orchestrator/parallel — Run all 4 specialists in parallel */
|
|
471
499
|
orchestrateParallel(prompt: string): Promise<OrchestratorResponse>;
|
|
500
|
+
/**
|
|
501
|
+
* POST /v1/fact-check — Verify claims against source context.
|
|
502
|
+
*
|
|
503
|
+
* @param request - Text and source context to verify
|
|
504
|
+
* @returns FactCheckResponse with verdict, action, and per-claim results
|
|
505
|
+
*
|
|
506
|
+
* @example
|
|
507
|
+
* ```typescript
|
|
508
|
+
* const result = await client.factCheck({
|
|
509
|
+
* text: 'Returns accepted within 60 days.',
|
|
510
|
+
* source_context: 'Our policy allows returns within 14 days.',
|
|
511
|
+
* mode: 'lexical',
|
|
512
|
+
* });
|
|
513
|
+
* console.log(result.verdict); // "rejected"
|
|
514
|
+
* ```
|
|
515
|
+
*/
|
|
516
|
+
factCheck(request: FactCheckRequest): Promise<FactCheckResponse>;
|
|
472
517
|
}
|
|
473
518
|
|
|
474
519
|
/**
|
|
@@ -589,4 +634,4 @@ declare class ToolNotFoundError extends WauldoError {
|
|
|
589
634
|
constructor(toolName: string);
|
|
590
635
|
}
|
|
591
636
|
|
|
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 };
|
|
637
|
+
export { AgentClient, type CallToolResponse, type ChatChoice, type ChatClientLike, type ChatMessage, type ChatRequest, type ChatResponse, type ChatUsage, type Chunk, type ChunkResult, type ClaimResult, type ClientOptions, type Concept, type ConceptResult, ConnectionError, Conversation, type DetailLevel, type EmbeddingData, type EmbeddingResponse, type EmbeddingUsage, type FactCheckRequest, type FactCheckResponse, 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,6 +1097,32 @@ 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
|
+
}
|
|
1100
1126
|
};
|
|
1101
1127
|
|
|
1102
1128
|
// src/mock_client.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1061,6 +1061,32 @@ 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
|
+
}
|
|
1064
1090
|
};
|
|
1065
1091
|
|
|
1066
1092
|
// src/mock_client.ts
|