Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

chore: lint & format

[email protected]5001fa78214f
diff --git a/libs/python/agent/agent/loops/fara/__init__.py b/libs/python/agent/agent/loops/fara/__init__.py
index 82a4ab9182..3d1baab85a 100644
--- a/libs/python/agent/agent/loops/fara/__init__.py
+++ b/libs/python/agent/agent/loops/fara/__init__.py
@@ -5,4 +5,4 @@ Original implementation from Microsoft: https://github.com/microsoft/Fara
from .config import FaraVlmConfig
-__all__ = ("FaraVlmConfig", )
+__all__ = ("FaraVlmConfig",)
diff --git a/libs/python/agent/agent/loops/fara/helpers.py b/libs/python/agent/agent/loops/fara/helpers.py
index f6df45448d..5ffc7a28bb 100644
--- a/libs/python/agent/agent/loops/fara/helpers.py
+++ b/libs/python/agent/agent/loops/fara/helpers.py
@@ -62,6 +62,7 @@ Here is the code.
</code>
</tool_call>"""
+
class NousFnCallPrompt:
def __init__(self, template_name: str = "default"):
"""Initialize NousFnCallPrompt with a specific template.
@@ -112,9 +113,7 @@ class NousFnCallPrompt:
content = content or []
fn_call = msg.function_call
if fn_call:
- if (not SPECIAL_CODE_MODE) or (
- CODE_TOOL_PATTERN not in fn_call.name
- ):
+ if (not SPECIAL_CODE_MODE) or (CODE_TOOL_PATTERN not in fn_call.name):
fc = {
"name": fn_call.name,
"arguments": json.loads(fn_call.arguments),
@@ -158,8 +157,7 @@ class NousFnCallPrompt:
tool_descs = [{"type": "function", "function": f} for f in functions]
tool_names = [
- function.get("name_for_model", function.get("name", ""))
- for function in functions
+ function.get("name_for_model", function.get("name", "")) for function in functions
]
tool_descs = "\n".join([json.dumps(f, ensure_ascii=False) for f in tool_descs])
@@ -173,9 +171,7 @@ class NousFnCallPrompt:
if messages[0].role == "system":
messages[0].content.append(ContentItem(text="\n\n" + tool_system))
else:
- messages = [
- Message(role="system", content=[ContentItem(text=tool_system)])
- ] + messages
+ messages = [Message(role="system", content=[ContentItem(text=tool_system)])] + messages
return messages
@@ -249,9 +245,9 @@ def parse_tool_call_from_text(text: str) -> Optional[Dict[str, Any]]:
brace_count = 0
json_end = json_start
for i in range(json_start, len(text)):
- if text[i] == '{':
+ if text[i] == "{":
brace_count += 1
- elif text[i] == '}':
+ elif text[i] == "}":
brace_count -= 1
if brace_count == 0:
json_end = i + 1
diff --git a/libs/python/agent/agent/loops/fara/schema.py b/libs/python/agent/agent/loops/fara/schema.py
index 7ec8c6505c..032119c7a5 100644
--- a/libs/python/agent/agent/loops/fara/schema.py
+++ b/libs/python/agent/agent/loops/fara/schema.py
@@ -143,7 +143,5 @@ class Message(BaseModelCompatibleDict):
def role_checker(cls, value: str) -> str:
values = ["system", "user", "assistant", "function"]
if value not in values:
- raise ValueError(
- f'{value} must be one of {",".join(values)}'
- )
+ raise ValueError(f'{value} must be one of {",".join(values)}')
return value