From 74c942c91110096d2a121daae904a4ed6a2a8e42 Mon Sep 17 00:00:00 2001 From: Calvin Smith Date: Wed, 19 Feb 2025 14:17:48 -0700 Subject: [PATCH] fix: LLM summarization prompt handles user messages (#6837) Co-authored-by: Calvin Smith --- .../condenser/impl/llm_summarizing_condenser.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/openhands/memory/condenser/impl/llm_summarizing_condenser.py b/openhands/memory/condenser/impl/llm_summarizing_condenser.py index 276d1c1e8748..54068f04547c 100644 --- a/openhands/memory/condenser/impl/llm_summarizing_condenser.py +++ b/openhands/memory/condenser/impl/llm_summarizing_condenser.py @@ -57,22 +57,29 @@ def condense(self, events: list[Event]) -> list[Event]: # Construct prompt for summarization prompt = """You are maintaining state history for an LLM-based code agent. Track: +USER_CONTEXT: (Preserve essential user requirements, problem descriptions, and clarifications in concise form) + STATE: {File paths, function signatures, data structures} TESTS: {Failing cases, error messages, outputs} CHANGES: {Code edits, variable updates} DEPS: {Dependencies, imports, external calls} INTENT: {Why changes were made, acceptance criteria} -SKIP: {Git clones, build logs} -SUMMARIZE: {File listings} -MAX_LENGTH: Keep summaries under 1000 words +PRIORITIZE: +1. Capture key user requirements and constraints +2. Maintain critical problem context +3. Keep all sections concise + +SKIP: {Git clones, build logs, file listings} Example history format: +USER_CONTEXT: Fix FITS card float representation - "0.009125" becomes "0.009124999999999999" causing comment truncation. Use Python's str() when possible while maintaining FITS compliance. + STATE: mod_float() in card.py updated TESTS: test_format() passed CHANGES: str(val) replaces f"{val:.16G}" DEPS: None modified -INTENT: Fix float precision overflow""" +INTENT: Fix precision while maintaining FITS compliance""" prompt + '\n\n'