Improve on agent and tasks configs
This commit is contained in:
@@ -225,8 +225,8 @@ class GPT4v_Agent:
|
||||
})
|
||||
|
||||
# Append trajectory
|
||||
assert len(self.observations) == len(self.actions) and len(self.actions) == len(self.thoughts)\
|
||||
, "The number of observations and actions should be the same."
|
||||
assert len(self.observations) == len(self.actions) and len(self.actions) == len(self.thoughts) \
|
||||
, "The number of observations and actions should be the same."
|
||||
|
||||
if len(self.observations) > self.max_trajectory_length:
|
||||
_observations = self.observations[-self.max_trajectory_length:]
|
||||
@@ -255,7 +255,7 @@ class GPT4v_Agent:
|
||||
{
|
||||
"type": "image_url",
|
||||
"image_url": {
|
||||
"url": f"data:image/jpeg;base64,{_screenshot}",
|
||||
"url": f"data:image/png;base64,{_screenshot}",
|
||||
"detail": "high"
|
||||
}
|
||||
}
|
||||
@@ -315,14 +315,14 @@ class GPT4v_Agent:
|
||||
]
|
||||
})
|
||||
else:
|
||||
raise ValueError("Invalid experiment type: " + self.exp) # 1}}}
|
||||
raise ValueError("Invalid experiment type: " + self.exp) # 1}}}
|
||||
|
||||
messages.append({
|
||||
"role": "assistant",
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": previous_thought.stip() if len(previous_thought)>0 else "No valid action"
|
||||
"text": previous_thought.strip() if len(previous_thought) > 0 else "No valid action"
|
||||
},
|
||||
]
|
||||
})
|
||||
@@ -436,7 +436,7 @@ class GPT4v_Agent:
|
||||
]
|
||||
})
|
||||
else:
|
||||
raise ValueError("Invalid experiment type: " + self.exp) # 1}}}
|
||||
raise ValueError("Invalid experiment type: " + self.exp) # 1}}}
|
||||
|
||||
with open("messages.json", "w") as f:
|
||||
f.write(json.dumps(messages, indent=4))
|
||||
|
||||
Reference in New Issue
Block a user