Skip to content

Commit

Permalink
final changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed Jul 6, 2024
1 parent 08089a1 commit 3c9d556
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
7 changes: 3 additions & 4 deletions vision_agent/agent/vision_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import difflib
import json
import logging
import subprocess
import sys
import tempfile
from pathlib import Path
Expand All @@ -25,7 +26,7 @@
)
from vision_agent.lmm import LMM, AzureOpenAILMM, Message, OpenAILMM
from vision_agent.utils import CodeInterpreterFactory, Execution
from vision_agent.utils.execute import CodeInterpreter
from vision_agent.utils.execute import CodeInterpreter, Execution
from vision_agent.utils.image_utils import b64_to_pil
from vision_agent.utils.sim import AzureSim, Sim
from vision_agent.utils.video import play_video
Expand Down Expand Up @@ -182,7 +183,6 @@ def write_code(
def write_test(
tester: LMM,
chat: List[Message],
image_desc: str,
tool_utils: str,
code: str,
feedback: str,
Expand All @@ -198,7 +198,6 @@ def write_test(
question=user_request,
code=code,
feedback=feedback,
# image_desc=image_desc,
media=media,
)
chat[-1]["content"] = prompt
Expand Down Expand Up @@ -234,7 +233,7 @@ def write_and_test_code(
format_memory(working_memory),
)
test = write_test(
tester, chat, image_desc, tool_utils, code, format_memory(working_memory), media
tester, chat, tool_utils, code, format_memory(working_memory), media
)

log_progress(
Expand Down
2 changes: 1 addition & 1 deletion vision_agent/lmm/lmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def __init__(
api_key: Optional[str] = None,
api_version: str = "2024-02-01",
azure_endpoint: Optional[str] = None,
max_tokens: int = 1024,
max_tokens: int = 4096,
json_mode: bool = False,
**kwargs: Any,
):
Expand Down
12 changes: 8 additions & 4 deletions vision_agent/utils/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,10 @@ def from_exception(exec: Exception, traceback_raw: List[str]) -> "Execution":
return Execution(
error=Error(
name=exec.__class__.__name__,
value=str(exec),
traceback_raw=traceback_raw,
value=_remove_escape_and_color_codes(str(exec)),
traceback_raw=[
_remove_escape_and_color_codes(line) for line in traceback_raw
],
)
)

Expand All @@ -373,8 +375,10 @@ def from_e2b_execution(exec: E2BExecution) -> "Execution": # type: ignore
error=(
Error(
name=exec.error.name,
value=exec.error.value,
traceback_raw=exec.error.traceback_raw,
value=_remove_escape_and_color_codes(exec.error.value),
traceback_raw=[
_remove_escape_and_color_codes(line) for line in exec.error.traceback_raw
]
)
if exec.error
else None
Expand Down

0 comments on commit 3c9d556

Please sign in to comment.