Add pydocstyle to the ruff rules (#52136)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Harry Mellor <hej.mellor@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
@@ -40,8 +40,7 @@ logger = init_logger(__name__)
|
||||
|
||||
|
||||
class ToolParser:
|
||||
"""
|
||||
Abstract ToolParser class that should not be used directly. Provided
|
||||
"""Abstract ToolParser class that should not be used directly. Provided
|
||||
properties and methods should be used in
|
||||
derived classes.
|
||||
"""
|
||||
@@ -186,8 +185,7 @@ class ToolParser:
|
||||
def extract_tool_calls(
|
||||
self, model_output: str, request: ChatCompletionRequest
|
||||
) -> ExtractedToolCallInformation:
|
||||
"""
|
||||
Static method that should be implemented for extracting tool calls from
|
||||
"""Static method that should be implemented for extracting tool calls from
|
||||
a complete model-generated string.
|
||||
Used for non-streaming responses where we have the entire model response
|
||||
available before sending to the client.
|
||||
@@ -207,8 +205,7 @@ class ToolParser:
|
||||
delta_token_ids: Sequence[int],
|
||||
request: ChatCompletionRequest,
|
||||
) -> DeltaMessage | None:
|
||||
"""
|
||||
Instance method that should be implemented for extracting tool calls
|
||||
"""Instance method that should be implemented for extracting tool calls
|
||||
from an incomplete response; for use when handling tool calls and
|
||||
streaming. Has to be an instance method because it requires state -
|
||||
the current tokens/diffs, but also the information about what has
|
||||
@@ -220,8 +217,7 @@ class ToolParser:
|
||||
|
||||
|
||||
class ToolParserManager:
|
||||
"""
|
||||
Central registry for ToolParser implementations.
|
||||
"""Central registry for ToolParser implementations.
|
||||
|
||||
Supports two modes:
|
||||
- Eager (immediate) registration via `register_module`
|
||||
@@ -233,8 +229,7 @@ class ToolParserManager:
|
||||
|
||||
@classmethod
|
||||
def get_tool_parser(cls, name: str) -> type[ToolParser]:
|
||||
"""
|
||||
Retrieve a registered or lazily registered ToolParser class.
|
||||
"""Retrieve a registered or lazily registered ToolParser class.
|
||||
|
||||
If the parser is lazily registered,
|
||||
it will be imported and cached on first access.
|
||||
@@ -301,8 +296,7 @@ class ToolParserManager:
|
||||
|
||||
@classmethod
|
||||
def register_lazy_module(cls, name: str, module_path: str, class_name: str) -> None:
|
||||
"""
|
||||
Register a lazy module mapping.
|
||||
"""Register a lazy module mapping.
|
||||
|
||||
Example:
|
||||
ToolParserManager.register_lazy_module(
|
||||
@@ -310,6 +304,7 @@ class ToolParserManager:
|
||||
module_path="vllm.tool_parsers.kimi_k2_parser",
|
||||
class_name="KimiK2ToolParser",
|
||||
)
|
||||
|
||||
"""
|
||||
cls.lazy_parsers[name] = (module_path, class_name)
|
||||
|
||||
@@ -320,8 +315,7 @@ class ToolParserManager:
|
||||
force: bool = True,
|
||||
module: type[ToolParser] | None = None,
|
||||
) -> type[ToolParser] | Callable[[type[ToolParser]], type[ToolParser]]:
|
||||
"""
|
||||
Register module immediately or lazily (as a decorator).
|
||||
"""Register module immediately or lazily (as a decorator).
|
||||
|
||||
Usage:
|
||||
@ToolParserManager.register_module("kimi_k2")
|
||||
|
||||
Reference in New Issue
Block a user