use different prompts for generation and refinements
This commit is contained in:
@@ -10,7 +10,7 @@ import lombok.Data;
|
|||||||
public class LLMOptions {
|
public class LLMOptions {
|
||||||
|
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private double temperature = 0.7;
|
private double temperature = 0.9;
|
||||||
|
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private int maxTokens = 4096;
|
private int maxTokens = 4096;
|
||||||
|
|||||||
@@ -39,18 +39,21 @@ public class LLMService {
|
|||||||
private final ReferenceService referenceService;
|
private final ReferenceService referenceService;
|
||||||
private final MongoTemplate mongoTemplate;
|
private final MongoTemplate mongoTemplate;
|
||||||
private final String systemPrompt;
|
private final String systemPrompt;
|
||||||
|
private final String refinerPrompt;
|
||||||
|
|
||||||
public LLMService(LLMFactory llmFactory,
|
public LLMService(LLMFactory llmFactory,
|
||||||
LLMResponseParser responseParser,
|
LLMResponseParser responseParser,
|
||||||
ReferenceService referenceService,
|
ReferenceService referenceService,
|
||||||
MongoTemplate mongoTemplate,
|
MongoTemplate mongoTemplate,
|
||||||
ResourceLoader resourceLoader,
|
ResourceLoader resourceLoader,
|
||||||
@Value("${indie.llm.system-prompt-path:classpath:prompts/site-generator.txt}") String promptPath) {
|
@Value("${indie.llm.system-prompt-path:classpath:prompts/site-generator.txt}") String promptPath,
|
||||||
|
@Value("${indie.llm.refiner-prompt-path:classpath:prompts/site-refiner.txt}") String refinerPath) {
|
||||||
this.llmFactory = llmFactory;
|
this.llmFactory = llmFactory;
|
||||||
this.responseParser = responseParser;
|
this.responseParser = responseParser;
|
||||||
this.referenceService = referenceService;
|
this.referenceService = referenceService;
|
||||||
this.mongoTemplate = mongoTemplate;
|
this.mongoTemplate = mongoTemplate;
|
||||||
this.systemPrompt = loadSystemPrompt(resourceLoader, promptPath);
|
this.systemPrompt = loadSystemPrompt(resourceLoader, promptPath);
|
||||||
|
this.refinerPrompt = loadSystemPrompt(resourceLoader, refinerPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SiteStructure generateSite(UUID userId, UUID siteId, String prompt, List<Reference> references) {
|
public SiteStructure generateSite(UUID userId, UUID siteId, String prompt, List<Reference> references) {
|
||||||
@@ -81,7 +84,7 @@ public class LLMService {
|
|||||||
LLMOptions options = LLMOptions.builder()
|
LLMOptions options = LLMOptions.builder()
|
||||||
.temperature(0.5)
|
.temperature(0.5)
|
||||||
.build();
|
.build();
|
||||||
LLMResult result = callLLM(systemPrompt, combinedPrompt, references, options);
|
LLMResult result = callLLM(refinerPrompt, combinedPrompt, references, options);
|
||||||
log.info("LLM refinement completed: model={}, latency={}ms, tokens={}+{}",
|
log.info("LLM refinement completed: model={}, latency={}ms, tokens={}+{}",
|
||||||
result.getModel(), result.getLatencyMs(),
|
result.getModel(), result.getLatencyMs(),
|
||||||
result.getPromptTokens(), result.getCompletionTokens());
|
result.getPromptTokens(), result.getCompletionTokens());
|
||||||
|
|||||||
Reference in New Issue
Block a user