mirror of
https://github.com/Hopiu/llm.git
synced 2026-04-29 17:34:45 +00:00
Better __repr__ for Response and AsyncResponse
This commit is contained in:
parent
f90f29dec9
commit
3b6e73445c
1 changed files with 7 additions and 1 deletions
|
|
@ -349,6 +349,12 @@ class Response(_BaseResponse):
|
|||
self._end = time.monotonic()
|
||||
self._done = True
|
||||
|
||||
def __repr__(self):
|
||||
text = "... not yet done ..."
|
||||
if self._done:
|
||||
text = "".join(self._chunks)
|
||||
return "<Response prompt='{}' text='{}'>".format(self.prompt.prompt, text)
|
||||
|
||||
|
||||
class AsyncResponse(_BaseResponse):
|
||||
model: "AsyncModel"
|
||||
|
|
@ -440,7 +446,7 @@ class AsyncResponse(_BaseResponse):
|
|||
text = "... not yet awaited ..."
|
||||
if self._done:
|
||||
text = "".join(self._chunks)
|
||||
return "<Response prompt='{}' text='{}'>".format(self.prompt.prompt, text)
|
||||
return "<AsyncResponse prompt='{}' text='{}'>".format(self.prompt.prompt, text)
|
||||
|
||||
|
||||
class Options(BaseModel):
|
||||
|
|
|
|||
Loading…
Reference in a new issue