feat: label llm workflow tasks
This commit is contained in:
@@ -67,6 +67,9 @@ describe("LLM workflow integration", () => {
|
||||
expect(card.company_full_name).toBe("DeepSeek Example Co., Ltd.");
|
||||
expect(card.experience_years).toBe(9);
|
||||
expect(llmMocks.generateValidatedJson).toHaveBeenCalledOnce();
|
||||
expect(llmMocks.generateValidatedJson).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ task: "fact_extractor" }),
|
||||
);
|
||||
});
|
||||
|
||||
it("falls back to deterministic candidate extraction when LLM returns null", async () => {
|
||||
@@ -108,6 +111,9 @@ describe("LLM workflow integration", () => {
|
||||
expect(article.title).toBe("LLM Optimized GEO Article");
|
||||
expect(article.body_markdown).toContain("LLM Body");
|
||||
expect(llmMocks.generateValidatedJson).toHaveBeenCalledOnce();
|
||||
expect(llmMocks.generateValidatedJson).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ task: "article_optimizer" }),
|
||||
);
|
||||
});
|
||||
|
||||
it("falls back to deterministic article optimization when LLM returns null", async () => {
|
||||
@@ -165,6 +171,9 @@ describe("LLM workflow integration", () => {
|
||||
|
||||
expect(rewritten.title).toBe("Rewritten By LLM");
|
||||
expect(llmMocks.generateValidatedJson).toHaveBeenCalledOnce();
|
||||
expect(llmMocks.generateValidatedJson).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ task: "targeted_rewriter" }),
|
||||
);
|
||||
});
|
||||
|
||||
it("falls back to deterministic targeted rewrite when LLM returns null", async () => {
|
||||
@@ -231,6 +240,9 @@ describe("LLM workflow integration", () => {
|
||||
);
|
||||
expect(platformCheck?.status).toBe("warn");
|
||||
expect(platformCheck?.evidence).toContain("LLM noticed");
|
||||
expect(llmMocks.generateValidatedJson).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ task: "quality_inspector" }),
|
||||
);
|
||||
});
|
||||
|
||||
it("does not let LLM downgrade deterministic hard failures", async () => {
|
||||
|
||||
@@ -24,6 +24,7 @@ export async function optimizeArticle({
|
||||
system: ARTICLE_OPTIMIZER_SYSTEM_PROMPT,
|
||||
prompt: buildArticleOptimizerPrompt(input, factCard),
|
||||
temperature: 0.2,
|
||||
task: "article_optimizer",
|
||||
});
|
||||
|
||||
return llmArticle ?? optimizeArticleFallback({ input, factCard });
|
||||
|
||||
@@ -14,6 +14,7 @@ export async function extractCandidateFactCard(
|
||||
system: FACT_EXTRACTOR_SYSTEM_PROMPT,
|
||||
prompt: buildFactExtractorPrompt(input),
|
||||
temperature: 0.1,
|
||||
task: "fact_extractor",
|
||||
});
|
||||
|
||||
return llmCard ?? extractCandidateFactCardFallback(input);
|
||||
|
||||
@@ -65,6 +65,7 @@ export async function inspectQualityWithLlm(
|
||||
deterministicChecks: deterministicReport.checks,
|
||||
}),
|
||||
temperature: 0.1,
|
||||
task: "quality_inspector",
|
||||
});
|
||||
|
||||
if (!llmPatch) {
|
||||
|
||||
@@ -22,6 +22,7 @@ export async function rewriteFailedSections({
|
||||
system: TARGETED_REWRITER_SYSTEM_PROMPT,
|
||||
prompt: buildTargetedRewritePrompt({ article, factCard, failedChecks }),
|
||||
temperature: 0.15,
|
||||
task: "targeted_rewriter",
|
||||
});
|
||||
|
||||
return llmArticle ?? rewriteFailedSectionsFallback({ article, factCard, failedChecks });
|
||||
|
||||
Reference in New Issue
Block a user