25 lines
2.4 KiB
C#
25 lines
2.4 KiB
C#
using System.Globalization;
|
|
|
|
namespace PaperlessAI.Models;
|
|
|
|
public class Configuration(IConfiguration config)
|
|
{
|
|
public string Model { get; set; } = config["LlmAgent:Model"] ?? throw new InvalidOperationException("Configuration not found \"LlmAgent:Model\"");
|
|
public string McpServer { get; set; } = config["LlmAgent:McpServer"] ?? throw new InvalidOperationException("Configuration not found \"LlmAgent:McpServer\"");
|
|
public int ContextLength { get; set; } = int.Parse(config["LlmAgent:ContextLength"] ?? throw new InvalidOperationException("Configuration not found \"LlmAgent:ContextLength\""));
|
|
public int max_output_tokens { get; set; } = int.Parse(config["LlmAgent:MaxOutputTokens"] ?? throw new InvalidOperationException("Configuration not found \"LlmAgent:MaxOutputTokens\""));
|
|
public double Temperature { get; set; } = double.Parse(config["LlmAgent:Temperature"] ?? throw new InvalidOperationException("Configuration not found \"LlmAgent:Temperature\""), CultureInfo.InvariantCulture);
|
|
public double TopP { get; set; } = double.Parse(config["LlmAgent:TopP"] ?? throw new InvalidOperationException("Configuration not found \"LlmAgent:TopP\""), CultureInfo.InvariantCulture);
|
|
public string Reasoning { get; set; } = config["LlmAgent:Reasoning"] ?? throw new InvalidOperationException("Configuration not found \"LlmAgent:Reasoning\"");
|
|
public int TimeoutSeconds { get; set; } = int.Parse(config["LlmAgent:TimeoutSeconds"] ?? throw new InvalidOperationException("Configuration not found \"LlmAgent:TimeoutSeconds\""));
|
|
public List<string> IntegrationsList { get; set; } = new List<string>() { config["LlmAgent:McpServer"] ?? throw new InvalidOperationException("Configuration not found \"LlmAgent:McpServer\"") };
|
|
|
|
public int CheckDocumentsToProcessJobPeriodSeconds { get; set; } = int.Parse(config["Settings:CheckDocumentsToProcessJobPeriodSeconds"] ?? throw new InvalidOperationException("Configuration not found \"Settings:CheckDocumentsToProcessJobPeriodSeconds\""));
|
|
|
|
|
|
public string SystemPrompt { get; set; } = File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "Prompts", "llm-system-prompt.txt")) ?? throw new InvalidOperationException("File \"SystemPrompt\" not found.");
|
|
public string Prompt { get; set; } = File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "Prompts", "llm-prompt.txt")) ?? throw new InvalidOperationException("File \"Prompt\" not found.");
|
|
|
|
|
|
}
|