Skip to content

Commit

Permalink
fixed type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed Aug 29, 2024
1 parent 1d0dcc1 commit 499733b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 7 additions & 3 deletions vision_agent/agent/vision_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def chat_with_code(
for chat_i in int_chat:
if "media" in chat_i:
for media in chat_i["media"]:
media = code_interpreter.upload_file(media)
media = code_interpreter.upload_file(cast(str, media))
chat_i["content"] += f" Media name {media}" # type: ignore
# Save dummy value for now since we just need to know the path
# name in the key 'media'. Later on we can add artifact support
Expand Down Expand Up @@ -264,8 +264,12 @@ def chat_with_code(

if self.verbosity >= 1:
_LOGGER.info(obs)
int_chat.append({"role": "observation", "content": obs, "execution": result})
orig_chat.append({"role": "observation", "content": obs, "execution": result})
int_chat.append(
{"role": "observation", "content": obs, "execution": result}
)
orig_chat.append(
{"role": "observation", "content": obs, "execution": result}
)

iterations += 1
last_response = response
Expand Down
2 changes: 1 addition & 1 deletion vision_agent/agent/vision_agent_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ def chat_with_workflow(
for chat_i in chat:
if "media" in chat_i:
for media in chat_i["media"]:
media = code_interpreter.upload_file(media)
media = code_interpreter.upload_file(cast(str, media))
chat_i["content"] += f" Media name {media}" # type: ignore
media_list.append(str(media))

Expand Down
6 changes: 4 additions & 2 deletions vision_agent/lmm/lmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def chat(
fixed_c["content"] = [{"type": "text", "text": c["content"]}] # type: ignore
if "media" in c:
for media in c["media"]:
encoded_media = encode_media(media)
encoded_media = encode_media(cast(str, media))

fixed_c["content"].append( # type: ignore
{
Expand Down Expand Up @@ -379,7 +379,9 @@ def chat(
fixed_chat = []
for message in chat:
if "media" in message:
message["images"] = [encode_media(m) for m in message["media"]]
message["images"] = [
encode_media(cast(str, m)) for m in message["media"]
]
del message["media"]
fixed_chat.append(message)
url = f"{self.url}/chat"
Expand Down

0 comments on commit 499733b

Please sign in to comment.