Skip to content

Commit

Permalink
black and isort
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed May 15, 2024
1 parent c4b4b4a commit c84812c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
13 changes: 10 additions & 3 deletions vision_agent/agent/agent_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
from pathlib import Path
from typing import Dict, List, Optional, Union

from rich.console import Console
from rich.syntax import Syntax

Expand Down Expand Up @@ -169,10 +170,14 @@ def chat(
for _ in range(self.max_turns):
code = write_program(question, feedback, self.coder_agent)
if self.verbose:
_CONSOLE.print(Syntax(code, "python", theme="gruvbox-dark", line_numbers=True))
_CONSOLE.print(
Syntax(code, "python", theme="gruvbox-dark", line_numbers=True)
)
debug = write_debug(question, code, feedback, self.tester_agent)
if self.verbose:
_CONSOLE.print(Syntax(debug, "python", theme="gruvbox-dark", line_numbers=True))
_CONSOLE.print(
Syntax(debug, "python", theme="gruvbox-dark", line_numbers=True)
)
results = execute_tests(code, debug)
_LOGGER.info(
f"execution results: passed: {results['passed']}\n{results['result']}"
Expand All @@ -183,7 +188,9 @@ def chat(
code, debug, results["result"].strip(), feedback, self.coder_agent # type: ignore
)
if self.verbose:
_CONSOLE.print(Syntax(code, "python", theme="gruvbox-dark", line_numbers=True))
_CONSOLE.print(
Syntax(code, "python", theme="gruvbox-dark", line_numbers=True)
)
else:
# TODO: Sometimes it prints nothing, so we need to handle that case
# TODO: The visual agent reflection does not work very well, needs more testing
Expand Down
4 changes: 3 additions & 1 deletion vision_agent/agent/vision_agent_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,9 @@ def chat_with_workflow(
self.long_term_memory,
self.verbosity,
)
success = all(task["success"] if "success" in task else False for task in plan)
success = all(
task["success"] if "success" in task else False for task in plan
)
working_memory.update(working_memory_i)

if not success:
Expand Down
2 changes: 1 addition & 1 deletion vision_agent/tools/tools_v2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import inspect
import io
import json
import logging
import tempfile
import json
from importlib import resources
from pathlib import Path
from typing import Any, Callable, Dict, List, Tuple, Union, cast
Expand Down
4 changes: 3 additions & 1 deletion vision_agent/utils/sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def save(self, sim_file: Union[str, Path]) -> None:
df = df.drop("embs", axis=1)
df.to_csv(sim_file / "df.csv", index=False)

def top_k(self, query: str, k: int = 5, thresh: Optional[float] = None) -> Sequence[Dict]:
def top_k(
self, query: str, k: int = 5, thresh: Optional[float] = None
) -> Sequence[Dict]:
"""Returns the top k most similar items to the query.
Parameters:
Expand Down

0 comments on commit c84812c

Please sign in to comment.