Skip to content

Commit

Permalink
fix: apply lint and mypy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
gcalmettes committed Oct 2, 2024
1 parent 1396d33 commit 0ee8677
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions vllm/entrypoints/openai/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# https://github.com/lm-sys/FastChat/blob/168ccc29d3f7edc50823016105c024fe2282732a/fastchat/protocol/openai_api_protocol.py
import time
from argparse import Namespace
from typing import Any, Dict, List, Literal, Optional, Union
from random import choices
from string import ascii_letters, digits
from typing import Any, Dict, List, Literal, Optional, Sequence, Union

import torch
from openai.types.chat import ChatCompletionContentPartParam
Expand Down Expand Up @@ -805,7 +805,7 @@ class ExtractedToolCallInformation(BaseModel):
tools_called: bool

# extracted tool calls
tool_calls: List[ToolCall | MistralToolCall]
tool_calls: Sequence[Union[ToolCall, MistralToolCall]]

# content - per OpenAI spec, content AND tool calls can be returned rarely
# But some models will do this intentionally
Expand All @@ -815,7 +815,8 @@ class ExtractedToolCallInformation(BaseModel):
class ChatMessage(OpenAIBaseModel):
role: str
content: Optional[str] = None
tool_calls: List[ToolCall | MistralToolCall] = Field(default_factory=list)
tool_calls: Sequence[Union[ToolCall, MistralToolCall]] = Field(
default_factory=list)


class ChatCompletionLogProb(OpenAIBaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def extract_tool_calls(self,
# load the JSON, and then use it to build the Function and
# Tool Call
function_call_arr = json.loads(raw_tool_call)
tool_calls: List[MistralToolCall] = [
tool_calls: Sequence[MistralToolCall] = [
MistralToolCall(
type="function",
function=FunctionCall(
Expand Down

0 comments on commit 0ee8677

Please sign in to comment.