Fix some ruff issues in code

This commit is contained in:
2025-12-07 05:33:39 +01:00
parent 7c9598f632
commit 10704896f9
12 changed files with 27 additions and 28 deletions
+7 -4
View File
@@ -2,7 +2,8 @@
import json
import logging
from typing import Any, AsyncGenerator
from collections.abc import AsyncGenerator
from typing import Any
from infrastructure.persistence import get_memory
@@ -77,7 +78,7 @@ class Agent:
tools_spec = self.prompt_builder.build_tools_spec()
# Tool execution loop
for iteration in range(self.max_tool_iterations):
for _iteration in range(self.max_tool_iterations):
# Call LLM with tools
llm_result = self.llm.complete(messages, tools=tools_spec)
@@ -229,7 +230,7 @@ class Agent:
tools_spec = self.prompt_builder.build_tools_spec()
# Tool execution loop
for iteration in range(self.max_tool_iterations):
for _iteration in range(self.max_tool_iterations):
# Call LLM with tools
llm_result = self.llm.complete(messages, tools=tools_spec)
@@ -317,7 +318,9 @@ class Agent:
)
# Stream tool result as content
result_text = f"\n🔧 {tool_name}: {json.dumps(tool_result, ensure_ascii=False)}\n"
result_text = (
f"\n🔧 {tool_name}: {json.dumps(tool_result, ensure_ascii=False)}\n"
)
yield {
"id": completion_id,
"object": "chat.completion.chunk",
+4 -4
View File
@@ -46,13 +46,13 @@ def _create_tool_from_function(func: Callable) -> Tool:
# Map Python types to JSON schema types
param_type = "string" # default
if param.annotation != inspect.Parameter.empty:
if param.annotation == str:
if param.annotation is str:
param_type = "string"
elif param.annotation == int:
elif param.annotation is int:
param_type = "integer"
elif param.annotation == float:
elif param.annotation is float:
param_type = "number"
elif param.annotation == bool:
elif param.annotation is bool:
param_type = "boolean"
properties[param_name] = {