atlasbot: tune synth and followup style
This commit is contained in:
parent
d8249bba37
commit
d9489f8790
@ -483,8 +483,17 @@ class AnswerEngine:
|
||||
plan: ModePlan,
|
||||
call_llm: Callable[..., Any],
|
||||
) -> str:
|
||||
style_hint = _style_hint(classify)
|
||||
if not subanswers:
|
||||
prompt = prompts.SYNTHESIZE_PROMPT + "\nQuestion: " + question
|
||||
prompt = (
|
||||
prompts.SYNTHESIZE_PROMPT
|
||||
+ "\nQuestion: "
|
||||
+ question
|
||||
+ "\nStyle: "
|
||||
+ style_hint
|
||||
+ "\nQuestionType: "
|
||||
+ (classify.get("question_type") or "unknown")
|
||||
)
|
||||
return await call_llm(prompts.SYNTHESIZE_SYSTEM, prompt, context=context, model=plan.model, tag="synth")
|
||||
draft_prompts = []
|
||||
for idx in range(plan.drafts):
|
||||
@ -492,6 +501,10 @@ class AnswerEngine:
|
||||
prompts.SYNTHESIZE_PROMPT
|
||||
+ "\nQuestion: "
|
||||
+ question
|
||||
+ "\nStyle: "
|
||||
+ style_hint
|
||||
+ "\nQuestionType: "
|
||||
+ (classify.get("question_type") or "unknown")
|
||||
+ "\nSubanswers:\n"
|
||||
+ "\n".join([f"- {item}" for item in subanswers])
|
||||
+ f"\nDraftIndex: {idx + 1}"
|
||||
@ -982,6 +995,14 @@ def _default_scores() -> AnswerScores:
|
||||
return AnswerScores(confidence=60, relevance=60, satisfaction=60, hallucination_risk="medium")
|
||||
|
||||
|
||||
def _style_hint(classify: dict[str, Any]) -> str:
|
||||
style = (classify.get("answer_style") or "").strip().lower()
|
||||
qtype = (classify.get("question_type") or "").strip().lower()
|
||||
if style == "insightful" or qtype in {"open_ended", "planning"}:
|
||||
return "insightful"
|
||||
return "direct"
|
||||
|
||||
|
||||
def _needs_evidence_fix(reply: str, classify: dict[str, Any]) -> bool:
|
||||
if not reply:
|
||||
return False
|
||||
|
||||
@ -82,11 +82,14 @@ SYNTHESIZE_SYSTEM = (
|
||||
CLUSTER_SYSTEM
|
||||
+ " Synthesize a final answer from sub-answers. "
|
||||
+ "Keep it conversational and grounded. "
|
||||
+ "Do not say 'based on the snapshot' or 'based on the context'."
|
||||
)
|
||||
|
||||
SYNTHESIZE_PROMPT = (
|
||||
"Write a final response to the user. "
|
||||
"Use sub-answers as evidence, avoid raw metric dumps unless asked. "
|
||||
"If Style is insightful or the question is open-ended, choose 1-2 salient points and explain why they stand out. "
|
||||
"If Style is direct, answer concisely with the specific value requested."
|
||||
)
|
||||
|
||||
EVIDENCE_FIX_SYSTEM = (
|
||||
@ -188,7 +191,8 @@ FOLLOWUP_SYSTEM = (
|
||||
)
|
||||
|
||||
FOLLOWUP_PROMPT = (
|
||||
"Answer the follow-up using provided evidence. Be conversational and concise."
|
||||
"Answer the follow-up using provided evidence. "
|
||||
"Be conversational and concise, and avoid restating all metrics."
|
||||
)
|
||||
|
||||
SELECT_CLAIMS_PROMPT = (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user