Skip to content

Commit

Permalink
fix: LLM summarization prompt handles user messages (#6837)
Browse files Browse the repository at this point in the history
Co-authored-by: Calvin Smith <[email protected]>
  • Loading branch information
csmith49 and Calvin Smith authored Feb 19, 2025
1 parent eed7e2d commit 74c942c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions openhands/memory/condenser/impl/llm_summarizing_condenser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down

0 comments on commit 74c942c

Please sign in to comment.