wauldo 0.2.0 → 0.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.mts CHANGED
@@ -340,6 +340,30 @@ interface FactCheckResponse {
340
340
  mode_warning?: string | null;
341
341
  processing_time_ms: number;
342
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
+ }
343
367
  /** Minimal interface required by Conversation — implemented by both HttpClient and MockHttpClient */
344
368
  interface ChatClientLike {
345
369
  chat(request: ChatRequest, options?: RequestOptions): Promise<ChatResponse>;
@@ -514,6 +538,19 @@ declare class HttpClient {
514
538
  * ```
515
539
  */
516
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>;
517
554
  }
518
555
 
519
556
  /**
@@ -634,4 +671,4 @@ declare class ToolNotFoundError extends WauldoError {
634
671
  constructor(toolName: string);
635
672
  }
636
673
 
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 };
674
+ export { AgentClient, type CallToolResponse, type ChatChoice, type ChatClientLike, type ChatMessage, type ChatRequest, type ChatResponse, type ChatUsage, type Chunk, type ChunkResult, type CitationDetail, 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 SourceChunk, type SourceType, TimeoutError, type ToolContent, type ToolDefinition, ToolNotFoundError, ValidationError, type VerifyCitationRequest, type VerifyCitationResponse, WauldoError, chatContent };
package/dist/index.d.ts CHANGED
@@ -340,6 +340,30 @@ interface FactCheckResponse {
340
340
  mode_warning?: string | null;
341
341
  processing_time_ms: number;
342
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
+ }
343
367
  /** Minimal interface required by Conversation — implemented by both HttpClient and MockHttpClient */
344
368
  interface ChatClientLike {
345
369
  chat(request: ChatRequest, options?: RequestOptions): Promise<ChatResponse>;
@@ -514,6 +538,19 @@ declare class HttpClient {
514
538
  * ```
515
539
  */
516
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>;
517
554
  }
518
555
 
519
556
  /**
@@ -634,4 +671,4 @@ declare class ToolNotFoundError extends WauldoError {
634
671
  constructor(toolName: string);
635
672
  }
636
673
 
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 };
674
+ export { AgentClient, type CallToolResponse, type ChatChoice, type ChatClientLike, type ChatMessage, type ChatRequest, type ChatResponse, type ChatUsage, type Chunk, type ChunkResult, type CitationDetail, 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 SourceChunk, type SourceType, TimeoutError, type ToolContent, type ToolDefinition, ToolNotFoundError, ValidationError, type VerifyCitationRequest, type VerifyCitationResponse, WauldoError, chatContent };
package/dist/index.js CHANGED
@@ -1123,6 +1123,27 @@ var HttpClient = class {
1123
1123
  );
1124
1124
  return validateResponse(data, "FactCheckResponse");
1125
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
+ }
1126
1147
  };
1127
1148
 
1128
1149
  // src/mock_client.ts
package/dist/index.mjs CHANGED
@@ -1087,6 +1087,27 @@ var HttpClient = class {
1087
1087
  );
1088
1088
  return validateResponse(data, "FactCheckResponse");
1089
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
+ }
1090
1111
  };
1091
1112
 
1092
1113
  // src/mock_client.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wauldo",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Official TypeScript SDK for Wauldo — Verified AI answers from your documents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",