const analyzeOperation = new NutrientViewer.ComparisonOperation(
NutrientViewer.ComparisonOperationType.AI,
{ operationType: NutrientViewer.AIComparisonOperationType.ANALYZE }
);
instance.compareDocuments(documents, analyzeOperation)
.then((result) => {
if (NutrientViewer.isAIDocumentAnalysisResult(result)) {
console.log('Summary:', result.summary);
console.log('Categories:', result.categories);
}
});
Result returned by AI-powered document comparison operations. This union type represents the response from NutrientViewer.Instance#compareDocuments when using NutrientViewer.ComparisonOperationType.AI.
The result type depends on the AI operation performed:
Analysis Operation (
NutrientViewer.AIComparisonOperationType.ANALYZE): Returns AIADocumentChangesAnalysisResponse containing:summary: AI-generated summary describing the overall nature of changescategories: Array of AI-detected change types (e.g., "Formatting", "Content Addition")changes: Standard DocumentComparison.DocumentComparisonResult with detailed differencesTagging Operation (
NutrientViewer.AIComparisonOperationType.TAG): Returns AIADocumentChangesTaggingResponse containing:references: Array where each item corresponds to a change with assigned category tagschanges: Standard DocumentComparison.DocumentComparisonResult with detailed differencesUse the provided type guards to determine which specific result type you received: