INNER CODE UNIT · Python
run_episode
princeton-nlp/WebShop · transfer/app.py:136
def run_episode(goal, env, verbose=True):
"""
Interact with amazon to find a product given input goal.
Input: text goal
Output: a url of found item on amazon.
"""
env = env.lower()
if env not in ENVIRONMENTS:
print(f"[ERROR] Environment {env} not recognized")
obs = "Amazon Shopping Game\nInstruction:" + goal + "\n[button] search [button]"
info = {'valid': ['search[stuff]'], 'image_feat': torch.zeros(512)}
product_map = {}
title_to_asin_map = {}
search_results_cache = {}
visited_asins, clicked_options = set(), set()
sub_page_type, page_type, page_num = None, None, None
search_terms, prod_title, asin = None, None, None