roughed in openai 1.x

This commit is contained in:
Paul Gauthier 2023-12-05 07:37:05 -08:00
parent fd34766aa9
commit 6ebc142377
15 changed files with 136 additions and 110 deletions

View file

@ -7,7 +7,8 @@ from aider.sendchat import simple_send_with_retries
class ChatSummary:
def __init__(self, model=models.Model.weak_model(), max_tokens=1024):
def __init__(self, client, model=models.Model.weak_model(), max_tokens=1024):
self.client = client
self.tokenizer = model.tokenizer
self.max_tokens = max_tokens
self.model = model
@ -84,7 +85,7 @@ class ChatSummary:
dict(role="user", content=content),
]
summary = simple_send_with_retries(self.model.name, messages)
summary = simple_send_with_retries(self.client, self.model.name, messages)
if summary is None:
raise ValueError(f"summarizer unexpectedly failed for {self.model.name}")
summary = prompts.summary_prefix + summary