-
Notifications
You must be signed in to change notification settings - Fork 15
KeyError: 'choice' #4
Description
Traceback (most recent call last):
File "/root/nlp/lib/python3.10/site-packages/guidance/_program_executor.py", line 109, in run
await self.visit(self.parse_tree, VariableStack([self.program._variables], self))
File "/root/nlp/lib/python3.10/site-packages/guidance/_program_executor.py", line 559, in visit
visited_children.append(await self.visit(child, variable_stack, inner_next_node, inner_next_next_node, inner_prev_node, node, parent_node))
File "/root/nlp/lib/python3.10/site-packages/guidance/_program_executor.py", line 524, in visit
command_output = await command_function(*positional_args, **named_args)
File "/root/nlp/lib/python3.10/site-packages/guidance/library/_assistant.py", line 13, in assistant
return await role(role_name="assistant", hidden=hidden, _parser_context=_parser_context, **kwargs)
File "/root/nlp/lib/python3.10/site-packages/guidance/library/_role.py", line 17, in role
new_content += await parser.visit(
File "/root/nlp/lib/python3.10/site-packages/guidance/_program_executor.py", line 559, in visit
visited_children.append(await self.visit(child, variable_stack, inner_next_node, inner_next_next_node, inner_prev_node, node, parent_node))
File "/root/nlp/lib/python3.10/site-packages/guidance/_program_executor.py", line 559, in visit
visited_children.append(await self.visit(child, variable_stack, inner_next_node, inner_next_next_node, inner_prev_node, node, parent_node))
File "/root/nlp/lib/python3.10/site-packages/guidance/_program_executor.py", line 266, in visit
visited_children = [await self.visit(child, variable_stack, next_node, next_next_node, prev_node, node, parent_node) for child in node]
File "/root/nlp/lib/python3.10/site-packages/guidance/_program_executor.py", line 266, in
visited_children = [await self.visit(child, variable_stack, next_node, next_next_node, prev_node, node, parent_node) for child in node]
File "/root/nlp/lib/python3.10/site-packages/guidance/_program_executor.py", line 379, in visit
command_output = await command_function(*positional_args, **named_args)
File "/root/nlp/lib/python3.10/site-packages/guidance/library/_select.py", line 151, in select
option_logprobs = await recursive_select([])
File "/root/nlp/lib/python3.10/site-packages/guidance/library/_select.py", line 121, in recursive_select
for k,v in logprobs_result["top_logprobs"][0].items():
TypeError: 'NoneType' object is not subscriptable
Error in program: 'NoneType' object is not subscriptable
call guidance with retry:
{{#system}}You are a helpful agent{{/system}}
{{#user}}
Given the task '{{task_name}}' and the capabilities '{{capabilities_text}}',
determine if the task is primitive which cannot be broken up further or compound which can be broken down more.
Please provide the answer as 'primitive' or 'compound':
{{/user}}
{{~#assistant~}}
{{select "choice" options=task_types}}
{{~/assistant~}}
result:
{{#system}}You are a helpful agent{{/system}}
{{#user}}
Given the task '{{task_name}}' and the capabilities '{{capabilities_text}}',
determine if the task is primitive which cannot be broken up further or compound which can be broken down more.
Please provide the answer as 'primitive' or 'compound':
{{/user}}
{{~#assistant~}}
{{select "choice" options=task_types}}
{{~/assistant~}}
Traceback (most recent call last):
File "/root/GPT-HTN-Planner/src/main.py", line 109, in
main()
File "/root/GPT-HTN-Planner/src/main.py", line 98, in main
plan = htn_planner.htn_planning()
File "/root/GPT-HTN-Planner/src/htn_planner.py", line 28, in htn_planning
root_node = self.htn_planning_recursive(
File "/root/GPT-HTN-Planner/src/text_utils.py", line 21, in wrapper
result = func(*args, **kwargs)
File "/root/GPT-HTN-Planner/src/htn_planner.py", line 47, in htn_planning_recursive
success, updated_state = self.decompose(root_node, state, 0, max_depth, capabilities_input, goal_task,
File "/root/GPT-HTN-Planner/src/text_utils.py", line 21, in wrapper
result = func(*args, **kwargs)
File "/root/GPT-HTN-Planner/src/htn_planner.py", line 106, in decompose
if is_task_primitive(task, capabilities_input):
File "/root/GPT-HTN-Planner/src/text_utils.py", line 21, in wrapper
result = func(*args, **kwargs)
File "/root/GPT-HTN-Planner/src/gpt4_utils.py", line 33, in is_task_primitive
response = htn_prompts.is_task_primitive(task_name, capabilities_text)
File "/root/GPT-HTN-Planner/src/guidance_prompts/htn_prompts.py", line 299, in is_task_primitive
return result['choice']
File "/root/nlp/lib/python3.10/site-packages/guidance/_program.py", line 470, in getitem
return self._variables[key]
KeyError: 'choice'
when running main.py, i met error with htm_prompt
can you help me with this error?