using FluentResults; using NexusReader.Application.DTOs.AI; using NexusReader.Application.Queries.Intelligence; namespace NexusReader.Application.Abstractions.Services; public interface IKnowledgeService { Task> GetKnowledgeAsync(string text, string tenantId, Guid? ebookId = null, CancellationToken cancellationToken = default); Task> GetGraphDataAsync(string text, string tenantId, Guid? ebookId = null, CancellationToken cancellationToken = default); Task> GetKnowledgeMapAsync(string text, string tenantId, Guid? ebookId = null, CancellationToken cancellationToken = default); Task> GetSummaryAndQuizAsync(string text, string tenantId, Guid? ebookId = null, CancellationToken cancellationToken = default); Task>> GetRelevantContextAsync(string query, string tenantId, CancellationToken cancellationToken = default); Task> VerifyGroundednessAsync(string answer, string context, string tenantId, CancellationToken cancellationToken = default); Task>> SearchLibrarySemanticallyAsync(string queryText, string tenantId, int limit, CancellationToken cancellationToken = default); Task> AskQuestionAsync(string question, string tenantId, Guid? ebookId = null, int limit = 5, CancellationToken cancellationToken = default); Task> GetGlobalIntelligenceAsync(string queryText, string userId, string tenantId, CancellationToken cancellationToken = default); Task ClearCacheAsync(CancellationToken cancellationToken = default); } public record GroundednessResult(float Score, string Rationale, bool IsGrounded);