feat(backend): add LLM provider abstraction, contextual ranking and explanations
Add a pluggable LLM provider with an offline template fallback, prompt builder, contextual match scoring (area/location boosts, availability), per-solution explanations and in-memory request limiting for cost control.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
namespace TarninaHub.Infrastructure.Llm;
|
||||
|
||||
public sealed class LlmSettings
|
||||
{
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
/// <summary>Provider identifier, e.g. "openai" (OpenAI-compatible chat API).</summary>
|
||||
public string Provider { get; set; } = "openai";
|
||||
|
||||
public string? ApiKey { get; set; }
|
||||
|
||||
public string BaseUrl { get; set; } = "https://api.openai.com/v1";
|
||||
|
||||
public string Model { get; set; } = "gpt-4o-mini";
|
||||
|
||||
public int MaxTokens { get; set; } = 256;
|
||||
|
||||
public int MaxRequestsPerMinute { get; set; } = 30;
|
||||
|
||||
public int TimeoutSeconds { get; set; } = 20;
|
||||
|
||||
public bool IsConfigured => Enabled && !string.IsNullOrWhiteSpace(ApiKey);
|
||||
}
|
||||
Reference in New Issue
Block a user