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
@@ -115,8 +115,7 @@ def build_response_output_items(
|
||||
def should_continue_final_message(
|
||||
request_input: str | list[ResponseInputOutputItem],
|
||||
) -> bool:
|
||||
"""
|
||||
Determine if the last input message is a partial assistant message
|
||||
"""Determine if the last input message is a partial assistant message
|
||||
that should be continued rather than starting a new generation.
|
||||
|
||||
This enables partial message completion similar to Anthropic's Messages API,
|
||||
@@ -132,6 +131,7 @@ def should_continue_final_message(
|
||||
|
||||
Returns:
|
||||
True if the final message should be continued, False otherwise
|
||||
|
||||
"""
|
||||
if isinstance(request_input, str):
|
||||
# Simple string input is always a user message
|
||||
@@ -226,8 +226,7 @@ def _construct_message_from_response_item(
|
||||
item: ResponseInputOutputItem,
|
||||
prev_msg: ChatCompletionMessageParam | None = None,
|
||||
) -> ChatCompletionMessageParam | None:
|
||||
"""
|
||||
Returns a new message or None. If `None`, `prev_msg` might be updated.
|
||||
"""Returns a new message or None. If `None`, `prev_msg` might be updated.
|
||||
If `prev_msg` is `None`, a new message is always returned.
|
||||
"""
|
||||
prev_assistant_msg = (
|
||||
@@ -360,9 +359,7 @@ def extract_function_tool_names(tools: list[Tool]) -> frozenset[str]:
|
||||
|
||||
|
||||
def extract_tool_types(tools: list[Tool]) -> set[str]:
|
||||
"""
|
||||
Extracts the tool types from the given tools.
|
||||
"""
|
||||
"""Extracts the tool types from the given tools."""
|
||||
tool_types: set[str] = set()
|
||||
for tool in tools:
|
||||
if tool.type == "mcp":
|
||||
@@ -379,8 +376,7 @@ def extract_tool_types(tools: list[Tool]) -> set[str]:
|
||||
def convert_tool_responses_to_completions_format(
|
||||
tool: dict,
|
||||
) -> ChatCompletionToolsParam:
|
||||
"""
|
||||
Convert a flat Responses tool schema:
|
||||
"""Convert a flat Responses tool schema:
|
||||
{"type": "function", "name": "...", "description": "...", "parameters": {...}}
|
||||
into a Chat Completions tool param for chat-template rendering.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user