From 598bcd514d9864d432f5b24d3b76f6afe4e09df8 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Thu, 7 Nov 2024 07:27:59 -0500 Subject: [PATCH] Refactor EnhancedContextPlugin to include list of all topics mentioned --- examples/enhanced_context.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/enhanced_context.py b/examples/enhanced_context.py index efaadab..553bd71 100644 --- a/examples/enhanced_context.py +++ b/examples/enhanced_context.py @@ -683,10 +683,15 @@ class EnhancedContextPlugin(sm.BasePlugin): source_breakdown = f"(User: {user_count}, AI: {llm_count})" output_parts.append(f"• {entity}: {total} mentions {source_breakdown}") + # Add list of all topics + all_topics = [entity[0] for entity in sorted_entities] + if all_topics: + output_parts.append("\n[bold]All Topics Mentioned:[/]") + output_parts.append(", ".join(all_topics)) + return "\n".join(output_parts) -# Replace the example usage code at the bottom with this chat interface: def get_multiline_input() -> str: """Get input from user. Press Enter to send.""" session = PromptSession()