34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
// <copyright file="NullExplanationInferenceClient.cs" company="StellaOps">
|
|
// Copyright (c) StellaOps. Licensed under the BUSL-1.1.
|
|
// </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);
|
|
}
|
|
}
|