Skip to content

Commit bab92a8

Browse files
committed
Fix line length violations (E501) in logger and serving_chat
- Break long conditional expressions into multiple lines - Fix tool call logging lines exceeding 80 characters - Remove trailing whitespace - Maintain code readability and functionality Signed-off-by: Adrian Garcia <adrian.garcia@inceptionai.ai>
1 parent d356a3e commit bab92a8

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

vllm/entrypoints/logger.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ def log_outputs(
6969

7070
stream_info = ""
7171
if is_streaming:
72-
stream_info = " (streaming delta)" if delta else " (streaming complete)"
72+
stream_info = (" (streaming delta)" if delta else
73+
" (streaming complete)")
7374

7475
logger.info(
7576
"Generated response %s%s: output: %r, "

vllm/entrypoints/openai/serving_chat.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -830,8 +830,11 @@ async def chat_completion_stream_generator(
830830
delta_content = ""
831831
if delta_message.content:
832832
delta_content = delta_message.content
833-
elif delta_message.tool_calls and delta_message.tool_calls[0].function and delta_message.tool_calls[0].function.arguments:
834-
delta_content = delta_message.tool_calls[0].function.arguments
833+
elif (delta_message.tool_calls and
834+
delta_message.tool_calls[0].function and
835+
delta_message.tool_calls[0].function.arguments):
836+
func_args = delta_message.tool_calls[0].function.arguments
837+
delta_content = func_args
835838

836839
if delta_content:
837840
self.request_logger.log_outputs(
@@ -1200,8 +1203,10 @@ async def chat_completion_full_generator(
12001203
tool_call_descriptions = []
12011204
for tool_call in choice.message.tool_calls:
12021205
if hasattr(tool_call.function, 'name') and hasattr(tool_call.function, 'arguments'):
1203-
tool_call_descriptions.append(f"{tool_call.function.name}({tool_call.function.arguments})")
1204-
output_text = f"[tool_calls: {', '.join(tool_call_descriptions)}]"
1206+
tool_call_descriptions.append(
1207+
f"{tool_call.function.name}({tool_call.function.arguments})")
1208+
tool_calls_str = ', '.join(tool_call_descriptions)
1209+
output_text = f"[tool_calls: {tool_calls_str}]"
12051210

12061211
if output_text:
12071212
# Get the corresponding output token IDs

0 commit comments

Comments
 (0)