@@ -1,7 +0,0 @@
|
||||
namespace Api.Services.Contracts;
|
||||
|
||||
public interface IAiClient
|
||||
{
|
||||
Task<float[]> CreateEmbeddingAsync(string input, CancellationToken ct);
|
||||
Task<string> CreateChatCompletionAsync(string systemPrompt, string userPrompt, decimal temperature, CancellationToken ct);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using Api.Services.Contracts.Models;
|
||||
using Api.Models;
|
||||
|
||||
namespace Api.Services.Contracts;
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
using Api.Services.Contracts.Models;
|
||||
|
||||
namespace Api.Services.Contracts;
|
||||
|
||||
public interface IRagRepository
|
||||
{
|
||||
Task InitializeAsync(CancellationToken ct);
|
||||
Task<RagDocumentRecord?> GetDocumentByTextHashAsync(string textHash, string? sourceUrl, CancellationToken ct);
|
||||
Task<RagDocumentRecord?> GetDocumentByIdAsync(string id, CancellationToken ct);
|
||||
Task SaveDocumentAsync(RagDocumentRecord document, IReadOnlyList<RagChunkRecord> chunks, CancellationToken ct);
|
||||
Task<IReadOnlyList<SearchCandidateChunk>> SearchChunksAsync(float[] queryEmbedding, IReadOnlyList<string>? targetTypes, int topK, CancellationToken ct);
|
||||
Task<float[]?> GetEmbeddingAsync(string cacheKey, CancellationToken ct);
|
||||
Task SaveEmbeddingAsync(string cacheKey, string model, string textHash, float[] vector, CancellationToken ct);
|
||||
Task<string?> GetChatCompletionAsync(string cacheKey, CancellationToken ct);
|
||||
Task SaveChatCompletionAsync(string cacheKey, string model, decimal temperature, string responseText, CancellationToken ct);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Api.Requests;
|
||||
using Api.Responses;
|
||||
using Api.Services.Contracts.Models;
|
||||
using Api.Models;
|
||||
using Api.Models.Requests;
|
||||
using Api.Models.Responses;
|
||||
|
||||
namespace Api.Services.Contracts;
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace Api.Services.Contracts.Models
|
||||
{
|
||||
public sealed class DocumentClassification
|
||||
{
|
||||
public required string DocumentType { get; init; }
|
||||
public double Confidence { get; init; }
|
||||
public required string Title { get; init; }
|
||||
public Dictionary<string, string> Metadata { get; init; } = [];
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace Api.Services.Contracts.Models
|
||||
{
|
||||
public sealed class RagChunkRecord
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
public required string DocumentId { get; init; }
|
||||
public int ChunkIndex { get; init; }
|
||||
public required string Text { get; init; }
|
||||
public required float[] Embedding { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace Api.Services.Contracts.Models
|
||||
{
|
||||
public sealed class RagDocumentDetails
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
public required string DocumentType { get; init; }
|
||||
public required string Title { get; init; }
|
||||
public string? SourceUrl { get; init; }
|
||||
public required string Text { get; init; }
|
||||
public required string TextHash { get; init; }
|
||||
public DateTimeOffset CreatedAt { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace Api.Services.Contracts.Models
|
||||
{
|
||||
public sealed class RagDocumentRecord
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
public required string DocumentType { get; init; }
|
||||
public required string Title { get; init; }
|
||||
public string? SourceUrl { get; init; }
|
||||
public required string Text { get; init; }
|
||||
public required string TextHash { get; init; }
|
||||
public double TypeConfidence { get; init; }
|
||||
public string MetadataJson { get; init; } = "{}";
|
||||
public DateTimeOffset CreatedAt { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Api.Services.Contracts.Models
|
||||
{
|
||||
public sealed class SearchCandidateChunk
|
||||
{
|
||||
public required RagDocumentRecord Document { get; init; }
|
||||
public required RagChunkRecord Chunk { get; init; }
|
||||
public double Score { get; init; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user