An AI Agent that interacts with Windows OS at GUI level.
Python
style: apply ruff format and fix the trailing whitespace findings
Hussain019d210f9bca
diff --git a/windows_use/agent/service.py b/windows_use/agent/service.pyindex e1f045b..1e58234 100644--- a/windows_use/agent/service.py+++ b/windows_use/agent/service.py@@ -232,7 +232,9 @@ class Agent(BaseAgent):name=llm_event.tool_call.name,params=llm_event.tool_call.params,thinking=llm_event.thinking.content if llm_event.thinking else None,- thinking_signature=llm_event.thinking.signature if llm_event.thinking else None,+ thinking_signature=llm_event.thinking.signature+ if llm_event.thinking+ else None,)breakcase LLMEventType.TEXT:@@ -486,7 +488,9 @@ class Agent(BaseAgent):name=llm_event.tool_call.name,params=llm_event.tool_call.params,thinking=llm_event.thinking.content if llm_event.thinking else None,- thinking_signature=llm_event.thinking.signature if llm_event.thinking else None,+ thinking_signature=llm_event.thinking.signature+ if llm_event.thinking+ else None,)breakcase LLMEventType.TEXT:diff --git a/windows_use/providers/azure_openai/llm.py b/windows_use/providers/azure_openai/llm.pyindex 07acc38..f3323e2 100644--- a/windows_use/providers/azure_openai/llm.py+++ b/windows_use/providers/azure_openai/llm.py@@ -128,7 +128,11 @@ class ChatAzureOpenAI(BaseChatLLM):"type": "function","function": {"name": msg.name, "arguments": json.dumps(msg.params)},}- assistant_msg: dict = {"role": "assistant", "content": None, "tool_calls": [tool_call]}+ assistant_msg: dict = {+ "role": "assistant",+ "content": None,+ "tool_calls": [tool_call],+ }if getattr(msg, "thinking", None):assistant_msg["reasoning_content"] = msg.thinkingopenai_messages.append(assistant_msg)diff --git a/windows_use/providers/cerebras/llm.py b/windows_use/providers/cerebras/llm.pyindex d1e5875..a917db7 100644--- a/windows_use/providers/cerebras/llm.py+++ b/windows_use/providers/cerebras/llm.py@@ -138,7 +138,9 @@ class ChatCerebras(BaseChatLLM):cerebras_messages.append({"role": "assistant",- "content": self._format_assistant_content(None, thinking) if thinking else None,+ "content": self._format_assistant_content(None, thinking)+ if thinking+ else None,"tool_calls": [tool_call],})diff --git a/windows_use/providers/deepseek/llm.py b/windows_use/providers/deepseek/llm.pyindex 09fe91b..1f6657b 100644--- a/windows_use/providers/deepseek/llm.py+++ b/windows_use/providers/deepseek/llm.py@@ -24,7 +24,7 @@ class ChatDeepSeek(ChatOpenAI):timeout: float = 600.0,max_retries: int = 2,temperature: float | None = None,- reasoning_effort: Literal['none','low','medium','high','xhigh','max'] = "high",+ reasoning_effort: Literal["none", "low", "medium", "high", "xhigh", "max"] = "high",thinking: bool = False,**kwargs,):diff --git a/windows_use/providers/google/llm.py b/windows_use/providers/google/llm.pyindex 7241bab..fb7927c 100644--- a/windows_use/providers/google/llm.py+++ b/windows_use/providers/google/llm.py@@ -3,7 +3,7 @@ import loggingimport osimport uuidfrom collections.abc import AsyncIterator, Iterator-from typing import Any, overload, Literal+from typing import Any, Literal, overloadfrom google import genaifrom google.genai import typesdiff --git a/windows_use/providers/groq/llm.py b/windows_use/providers/groq/llm.pyindex 326d3d2..20346cf 100644--- a/windows_use/providers/groq/llm.py+++ b/windows_use/providers/groq/llm.py@@ -130,7 +130,11 @@ class ChatGroq(BaseChatLLM):"type": "function","function": {"name": msg.name, "arguments": json.dumps(msg.params)},}- assistant_msg: dict = {"role": "assistant", "content": None, "tool_calls": [tool_call]}+ assistant_msg: dict = {+ "role": "assistant",+ "content": None,+ "tool_calls": [tool_call],+ }if getattr(msg, "thinking", None):assistant_msg["reasoning"] = msg.thinkinggroq_messages.append(assistant_msg)diff --git a/windows_use/providers/ollama/llm.py b/windows_use/providers/ollama/llm.pyindex aff0df6..1749dda 100644--- a/windows_use/providers/ollama/llm.py+++ b/windows_use/providers/ollama/llm.py@@ -323,7 +323,11 @@ class ChatOllama(BaseChatLLM):message = chunk.get("message", {})# Ollama may send usage in the final chunkif "eval_count" in chunk or "prompt_eval_count" in chunk:- thinking_tokens = max(1, sum(len(t) for t in accumulated_thinking) // 4) if accumulated_thinking else None+ thinking_tokens = (+ max(1, sum(len(t) for t in accumulated_thinking) // 4)+ if accumulated_thinking+ else None+ )usage = TokenUsage(prompt_tokens=chunk.get("prompt_eval_count", 0),completion_tokens=chunk.get("eval_count", 0),@@ -362,7 +366,9 @@ class ChatOllama(BaseChatLLM):yield LLMStreamEvent(type=LLMStreamEventType.THINK_END)think_started = Falsethinking_content = "".join(accumulated_thinking) or None- thinking_obj = Thinking(content=thinking_content, signature=None) if thinking_content else None+ thinking_obj = (+ Thinking(content=thinking_content, signature=None) if thinking_content else None+ )yield LLMStreamEvent(type=LLMStreamEventType.TOOL_CALL,tool_call=ToolCall(@@ -422,7 +428,11 @@ class ChatOllama(BaseChatLLM):message = chunk.get("message", {})# Ollama may send usage in the final chunkif "eval_count" in chunk or "prompt_eval_count" in chunk:- thinking_tokens = max(1, sum(len(t) for t in accumulated_thinking) // 4) if accumulated_thinking else None+ thinking_tokens = (+ max(1, sum(len(t) for t in accumulated_thinking) // 4)+ if accumulated_thinking+ else None+ )usage = TokenUsage(prompt_tokens=chunk.get("prompt_eval_count", 0),completion_tokens=chunk.get("eval_count", 0),@@ -461,7 +471,9 @@ class ChatOllama(BaseChatLLM):yield LLMStreamEvent(type=LLMStreamEventType.THINK_END)think_started = Falsethinking_content = "".join(accumulated_thinking) or None- thinking_obj = Thinking(content=thinking_content, signature=None) if thinking_content else None+ thinking_obj = (+ Thinking(content=thinking_content, signature=None) if thinking_content else None+ )yield LLMStreamEvent(type=LLMStreamEventType.TOOL_CALL,tool_call=ToolCall(diff --git a/windows_use/providers/openai/llm.py b/windows_use/providers/openai/llm.pyindex 85f902f..6782ee2 100644--- a/windows_use/providers/openai/llm.py+++ b/windows_use/providers/openai/llm.py@@ -50,7 +50,7 @@ class ChatOpenAI(BaseChatLLM):base_url: str | None = None,timeout: float = 600.0,max_retries: int = 2,- reasoning_effort: Literal['none','low','medium','high','xhigh'] = "high",+ reasoning_effort: Literal["none", "low", "medium", "high", "xhigh"] = "high",temperature: float | None = None,extra_body: dict | None = None,**kwargs,@@ -140,7 +140,11 @@ class ChatOpenAI(BaseChatLLM):"type": "function","function": {"name": msg.name, "arguments": json.dumps(msg.params)},}- assistant_msg: dict = {"role": "assistant", "content": None, "tool_calls": [tool_call]}+ assistant_msg: dict = {+ "role": "assistant",+ "content": None,+ "tool_calls": [tool_call],+ }if getattr(msg, "thinking", None):assistant_msg["reasoning_content"] = msg.thinkingopenai_messages.append(assistant_msg)@@ -267,10 +271,10 @@ class ChatOpenAI(BaseChatLLM):if json_mode:params["response_format"] = {"type": "json_object"}-+if self.extra_body:params["extra_body"] = self.extra_body-+if self._is_reasoning_model():params["reasoning_effort"] = self.reasoning_effort