Merge remote-tracking branch 'origin/main'

# Conflicts:
#	mm_agents/gpt_4v_agent.py
This commit is contained in:
Timothyxxx
2024-02-01 16:57:01 +08:00
16 changed files with 32 additions and 30 deletions

View File

@@ -30,6 +30,8 @@ from mm_agents.prompts import SYS_PROMPT_IN_SCREENSHOT_OUT_CODE, SYS_PROMPT_IN_S
SYS_PROMPT_IN_SOM_A11Y_OUT_TAG, \
SYS_PROMPT_SEEACT, ACTION_DESCRIPTION_PROMPT_SEEACT, ACTION_GROUNDING_PROMPT_SEEACT
import logging
logger = logging.getLogger("desktopenv.agent")
@@ -165,9 +167,6 @@ def parse_code_from_som_string(input_string, masks):
logger.error("Predicting the tag with index {} failed.".format(match))
return ""
return text
input_string = replace_tags_with_mappings(input_string, mappings)
actions = parse_code_from_string(input_string)
return actions
@@ -479,11 +478,14 @@ class GPT4v_Agent:
with open("messages.json", "w") as f:
f.write(json.dumps(messages, indent=4))
response = self.call_llm({
"model": self.model,
"messages": messages,
"max_tokens": self.max_tokens
})
try:
response = self.call_llm({
"model": self.model,
"messages": messages,
"max_tokens": self.max_tokens
})
except:
response = ""
logger.debug("RESPONSE: %s", response)