Skip to content

Conversation

@edwardzjl
Copy link
Owner

  • Refine system instruction to encourage full-conversation summarization.
  • Add token management to summary agent to handle long dialogues and avoid context overflows.

Pull Request Checklist

  • Test cases added for changed code.

Describe what you have changed in this PR.

- Refine system instruction to encourage full-conversation summarization.
- Add token management to summary agent to handle long dialogues and avoid context overflows.
@edwardzjl edwardzjl requested a review from Copilot July 10, 2025 03:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR extracts the inline summary chain into a dedicated module and adds token-management logic to handle long conversations without overflowing context.

  • Removed manual prompt construction in get_smry_chain and now call create_summary_agent
  • Introduced api/chatbot/agent/smry.py with trimming and token-management before summarization

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
api/chatbot/dependencies/agent.py Replaced inline summary chain with call to create_summary_agent
api/chatbot/agent/smry.py New summary module: prompts, trimming, token management, parsing
Comments suppressed due to low confidence (3)

api/chatbot/agent/smry.py:1

  • [nitpick] The module and filename 'smry.py' is an ambiguous abbreviation; consider renaming it to 'summary.py' (and similarly update references) for better readability.
from typing import Callable

api/chatbot/agent/smry.py:30

  • [nitpick] Add a docstring to create_summary_agent that explains its parameters (chat_model, token_counter, context_length) and describes the returned Runnable behavior.
def create_summary_agent(

api/chatbot/agent/smry.py:30

  • There are no unit tests covering the new summary agent logic (token trimming and summary output). Consider adding tests to validate trimming behavior and output parsing under various dialogue lengths.
def create_summary_agent(

@edwardzjl edwardzjl merged commit 79e9ab3 into main Jul 10, 2025
7 checks passed
@edwardzjl edwardzjl deleted the smry branch July 10, 2025 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants