Add summary prefix

This commit is contained in:
Paul Gauthier 2023-07-22 12:11:01 -03:00
parent c26917851f
commit 69aea3e745
3 changed files with 7 additions and 2 deletions

View file

@ -17,10 +17,10 @@ from rich.markdown import Markdown
from aider import models, prompts, utils
from aider.commands import Commands
from aider.history import ChatSummary
from aider.repo import GitRepo
from aider.repomap import RepoMap
from aider.sendchat import send_with_retries
from aider.history import ChatSummary
from ..dump import dump # noqa: F401
@ -200,7 +200,7 @@ class Coder:
if self.repo:
self.repo.add_new_files(fnames)
self.summarizer = ChatSummary()
self.summarizer = ChatSummary(self.main_model.name)
# validate the functions jsonschema
if self.functions:

View file

@ -15,6 +15,7 @@ class ChatSummary:
def summarize(self, messages):
num = len(messages)
dump(num)
if num < 2:
return messages
@ -66,6 +67,8 @@ class ChatSummary:
]
summary = simple_send_with_retries(model=models.GPT35.name, messages=messages)
summary = prompts.summary_prefix + summary
dump(summary)
return [dict(role="user", content=summary)]

View file

@ -40,3 +40,5 @@ Write *as* the user.
The user should refer to the assistant as *you*.
Start the summary with "I asked you...".
"""
summary_prefix = "I spoke to you previously about a number of things.\n"