Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyuan-lee authored Nov 19, 2024
1 parent aef267d commit 9e97e35
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,12 @@ def extract_tool_calls_streaming(
and cur_tool_end_count > prev_tool_end_count):
diff = self.prev_tool_call_arr[self.current_tool_id].get(
"arguments")
if diff:
diff = diff.encode('utf-8').decode('unicode_escape') if diff is str else diff
diff = json.dumps(diff, ensure_ascii=False)[len(self.streamed_args_for_tool[self.current_tool_id]):]
if diff:
diff = diff.encode('utf-8').decode(
'unicode_escape') if diff is str else diff
diff = json.dumps(
diff, ensure_ascii=False
)[len(self.streamed_args_for_tool[self.current_tool_id]):]
logger.debug(

Check failure on line 196 in vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py

View workflow job for this annotation

GitHub Actions / mypy (3.9)

unindent does not match any outer indentation level [syntax]

Check failure on line 196 in vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py

View workflow job for this annotation

GitHub Actions / ruff (3.12)

Ruff

vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py:196:1: SyntaxError: unindent does not match any outer indentation level

Check failure on line 196 in vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py

View workflow job for this annotation

GitHub Actions / mypy (3.10)

unindent does not match any outer indentation level [syntax]

Check failure on line 196 in vllm/entrypoints/openai/tool_parsers/hermes_tool_parser.py

View workflow job for this annotation

GitHub Actions / mypy (3.11)

unindent does not match any outer indentation level [syntax]
"Finishing tool and found diff that had not "
"been streamed yet: %s", diff)
Expand Down Expand Up @@ -305,7 +308,8 @@ def extract_tool_calls_streaming(

# last case -- we have an update to existing arguments.
elif cur_arguments and prev_arguments:
if isinstance(delta_text, str) and len(delta_text.rstrip())>=1 and delta_text.rstrip()[-1] == '}':
if isinstance(delta_text, str) and len(delta_text.rstrip(
)) >= 1 and delta_text.rstrip()[-1] == '}':
delta_text = delta_text.rstrip()[:-1]

logger.debug("got diff %s", delta_text)
Expand Down

0 comments on commit 9e97e35

Please sign in to comment.