MCPcopy Create free account
hub / github.com/LYX0501/DiscussNav / test_decisions

Method test_decisions

DiscussNav.py:384–405  ·  view source on GitHub ↗
(self, fused_pred_thought, observation, instruction)

Source from the content-addressed store, hash-verified

382 return matched_dict
383
384 def test_decisions(self, fused_pred_thought, observation, instruction):
385 if len(fused_pred_thought.keys()) == 1:
386 for key, value in fused_pred_thought.items():
387 return key, value
388 else:
389 fused_pred_thought_ = "; ".join(["Navigation Viewpoint ID: "+key+" Thought: "+value for key, value in fused_pred_thought.items()])
390 decision_prompt = [
391 {"role": "system", "content": "You are a decision testing expert. Your task is to evaluate the feasibility of each movement \
392 prediction based on thought process and environment. Then, you will make a final decision about navigation viewpoint ID without other words."},
393 {"role": "user", "content": f"Can you help me make a final decision? The Observation: {observation}, Navigation Instruction: {instruction}, {fused_pred_thought_}, Final Decision: "}
394 ]
395 for _ in range(3):
396 next_vp = gpt_response(decision_prompt, "gpt-4", 1, temperature=0)[0]["message"]["content"].strip()
397 if len(next_vp) != 32:
398 logger.info(f"{next_vp} Length Problem")
399 continue
400 if next_vp not in fused_pred_thought.keys():
401 logger.info(f"{next_vp} not in the candidates")
402 continue
403 break
404
405 return next_vp, fused_pred_thought[next_vp]
406
407def eval_pred(final_vp, nav_history, shortest_distances, eval_cache, instruction, scanId, des_vp, gt_path):
408 path = [item["viewpoint"] for item in nav_history]+[final_vp]

Callers 1

mainFunction · 0.95

Calls 1

gpt_responseFunction · 0.85

Tested by

no test coverage detected