using System; using System.Collections.Generic; namespace xAiApi.Models { /// /// Result of Ingesting Documents into an In-Memory Session ... /// public class XAiDocumentIngestResult { /// /// Session Identifier which must be used in Ask Requests ... /// public Guid SessionId { get; set; } /// /// Count of Successfully Processed Files ... /// public int FilesCount { get; set; } /// /// Count of Chunks (Vectors) Added to Session ... /// public int ChunksCount { get; set; } /// /// Total Vectors Count in Session after Ingest ... /// public int TotalVectorsCount { get; set; } /// /// Files which Skipped (Unsupported / Empty / Failed) ... /// public IList SkippedFiles { get; set; } = new List(); /// /// Session Expiration Time (UTC) based on Last Access ... /// public DateTime ExpiresAtUtc { get; set; } } /// /// Request for Asking a Question over Ingested Documents ... /// public class XAiDocumentAskRequest { /// /// Session Identifier ... /// public Guid SessionId { get; set; } /// /// User Question ... /// public string Prompt { get; set; } /// /// Count of Top Chunks used as Context (Optional) ... /// public int? TopK { get; set; } /// /// Minimum Similarity Score of Chunks (Optional) ... /// public float? MinScore { get; set; } } /// /// a Source Chunk which used for Generating Answer ... /// public class XAiDocumentSource { /// /// Doc and Chunk Identifier (e.g. "file.pdf#3") ... /// public string Identifier { get; set; } /// /// Source File Name ... /// public string FileName { get; set; } /// /// Chunk Index in Source File ... /// public int? ChunkIndex { get; set; } /// /// Similarity Score ... /// public float Score { get; set; } /// /// Short Snippet of Chunk Text ... /// public string Snippet { get; set; } /// /// Knowledge Scope the Chunk Retrieved from (Null for Session Based Documents) ... /// public string Scope { get; set; } /// /// Knowledge Type of the Chunk ... /// public string Type { get; set; } } /// /// Answer of a Chat With Documents Request ... /// public class XAiDocumentAnswer { /// /// Session Identifier ... /// public Guid SessionId { get; set; } /// /// Generated Answer ... /// public string Answer { get; set; } /// /// True when no Relevant Chunk Found in Session ... /// public bool NoContextFound { get; set; } /// /// Sources used for Generating Answer ... /// public IList Sources { get; set; } = new List(); } /// /// Streaming Chunk of a Chat With Documents Answer ... /// public class XAiDocumentAnswerChunk { /// /// Text Delta ... /// public string Text { get; set; } /// /// True for Last Chunk ... /// public bool IsFinal { get; set; } /// /// True when no Relevant Chunk Found in Session ... /// public bool NoContextFound { get; set; } /// /// Sources (Only Filled in First Chunk) ... /// public IList Sources { get; set; } } /// /// Public Info of a Document Session (without Embeddings) ... /// public class XAiDocumentSessionInfo { public Guid Id { get; set; } public TimeSpan Ttl { get; set; } public int VectorsCount { get; set; } public DateTime CreatedAtUtc { get; set; } public DateTime LastAccessAtUtc { get; set; } public DateTime ExpiresAtUtc { get; set; } public IList Files { get; set; } = new List(); } /// /// Document RAG Configuration ... /// public class XAiDocumentRAGDescriptor { public int MaxTopK { get; set; } = 20; public int DefaultTopK { get; set; } = 5; public int DefaultTtlMinutes { get; set; } = 30; public int EmbeddingBatchSize { get; set; } = 32; public int SourceSnippetLength { get; set; } = 200; public float DefaultMinScore { get; set; } = 0.35f; public string MetadataFileName { get; set; } = "fileName"; public string MetadataMimeType { get; set; } = "mimeType"; public string PromptName { get; set; } = "ChatWithDocuments"; public string MetadataChunkIndex { get; set; } = "chunkIndex"; // // Knowledge (Persistent RAG) Limits ... /// /// Max Files Accepted in a Single Ingest Request (0 = Unlimited) ... /// public int MaxFilesPerIngest { get; set; } = 20; /// /// Max Size of a Single File in Bytes (0 = Unlimited) ... /// public long MaxFileSizeBytes { get; set; } = 25 * 1024 * 1024; /// /// Max Distinct Documents Allowed in a Non-Global Scope (0 = Unlimited) ... /// public int MaxDocumentsPerScope { get; set; } = 50; } }