Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/transformers/commands/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ async def stream_output(self, stream: AsyncIterator[ChatCompletionStreamOutput])
text = ""
async for token in await stream:
outputs = token.choices[0].delta.content
request_id = token.id

if not outputs:
continue
Expand Down Expand Up @@ -168,7 +167,7 @@ async def stream_output(self, stream: AsyncIterator[ChatCompletionStreamOutput])

self._console.print()

return text, request_id
return text

def input(self) -> str:
"""Gets user input from the console."""
Expand Down Expand Up @@ -700,8 +699,6 @@ async def _inner_run(self):
interface.clear()
chat = self.clear_chat_history(args.system_prompt)

request_id = None

# Starts the session with a minimal help message at the top, so that a user doesn't get stuck
interface.print_help(minimal=True)
while True:
Expand Down Expand Up @@ -733,13 +730,12 @@ async def _inner_run(self):
chat,
stream=True,
extra_body={
"request_id": request_id,
"generation_config": generation_config.to_json_string(),
"model": model,
},
)

model_output, request_id = await interface.stream_output(stream)
model_output = await interface.stream_output(stream)

chat.append({"role": "assistant", "content": model_output})

Expand Down