17 lines
1.0 KiB
C#
17 lines
1.0 KiB
C#
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);
|
|
}
|