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.
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
namespace TarninaHub.Application.Matchmaking;
|
|
|
|
public sealed record LlmPrompt(string System, string User);
|
|
|
|
public static class MatchPromptBuilder
|
|
{
|
|
private const string SystemPrompt =
|
|
"Jesteś asystentem Małopolskiego Hubu Innowacji Społecznych. " +
|
|
"Wyjaśnij po polsku, prostym językiem (maks. 2 zdania), dlaczego proponowana " +
|
|
"innowacja pasuje do zgłoszonej potrzeby. Nie wymyślaj faktów.";
|
|
|
|
public static LlmPrompt BuildExplanation(
|
|
string problemTitle,
|
|
string problemDescription,
|
|
string challengeId,
|
|
string innovationTitle,
|
|
string innovationSummary,
|
|
string stage,
|
|
double score)
|
|
{
|
|
var user =
|
|
$"Potrzeba: {problemTitle}\n" +
|
|
$"Opis: {problemDescription}\n" +
|
|
$"Obszar: {challengeId}\n" +
|
|
$"Proponowana innowacja: {innovationTitle}\n" +
|
|
$"Streszczenie: {innovationSummary}\n" +
|
|
$"Etap: {stage}\n" +
|
|
$"Ocena dopasowania: {score:0.00}\n" +
|
|
"Uzasadnij krótko dopasowanie.";
|
|
|
|
return new LlmPrompt(SystemPrompt, user);
|
|
}
|
|
}
|