Skip to content

Commit

Permalink
Initial experimental response.reply() method
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jul 1, 2023
1 parent 5826b52 commit 674bd1d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions llm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ def __init__(self, prompt: Prompt, model: "Model", stream: bool):
self._debug = {}
self._done = False

def reply(self, prompt, system=None, **options):
new_prompt = [self.prompt.prompt, self.text(), prompt]
return self.model.execute(
Prompt(
"\n".join(new_prompt),
system=system or self.prompt.system or None,
model=self.model,
options=options,
),
stream=self.stream,
)

def __iter__(self):
if self._done:
return self._chunks
Expand Down

0 comments on commit 674bd1d

Please sign in to comment.