audit, advisories and doctors/setup work
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// <copyright file="NullExplanationInferenceClient.cs" company="StellaOps">
|
||||
// Copyright (c) StellaOps. Licensed under the AGPL-3.0-or-later.
|
||||
// </copyright>
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace StellaOps.AdvisoryAI.Explanation;
|
||||
|
||||
public sealed class NullExplanationInferenceClient : IExplanationInferenceClient
|
||||
{
|
||||
public Task<ExplanationInferenceResult> GenerateAsync(
|
||||
ExplanationPrompt prompt,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(prompt);
|
||||
|
||||
var promptHash = ComputeHash(prompt.Content ?? string.Empty);
|
||||
var content = $"Placeholder explanation (no model). prompt_hash=sha256:{promptHash}";
|
||||
|
||||
return Task.FromResult(new ExplanationInferenceResult
|
||||
{
|
||||
Content = content,
|
||||
Confidence = 0.0,
|
||||
ModelId = "stub-explainer:v0"
|
||||
});
|
||||
}
|
||||
|
||||
private static string ComputeHash(string content)
|
||||
{
|
||||
var bytes = SHA256.HashData(Encoding.UTF8.GetBytes(content));
|
||||
return Convert.ToHexStringLower(bytes);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user