jjz5463 commited on
Commit
3ce891c
·
1 Parent(s): 5f90409

update prompt

Browse files
Files changed (1) hide show
  1. chatbot_simulator.py +3 -25
chatbot_simulator.py CHANGED
@@ -95,7 +95,7 @@ Rules:
95
 
96
  # Update user state using GPT's response
97
  update_prompt = f"""
98
- Update the user state based on the input: '{user_input}'.
99
 
100
  Current user state (JSON format): {self.user_state}
101
 
@@ -113,17 +113,6 @@ Rules:
113
  - Ensure 'current_page' and 'task_completed' are keys in the returned dictionary.
114
  - Return **only the JSON object** without additional output or wrapping.
115
  - **AVOID OUTPUT A LIST**, must be JSON!
116
-
117
- The format for each page should be:
118
-
119
- {{
120
- "page_name": page_name
121
- "features": {{}},
122
- "user_data": {{
123
- "Data Entry 1": "Details of Data Entry 1",
124
- "Data Entry 2": "Details of Data Entry 2"
125
- }}
126
- }}
127
  """
128
 
129
  self.conversation.append({"role": "assistant", "content": update_prompt})
@@ -134,20 +123,9 @@ Rules:
134
 
135
  if isinstance(updated_state, list):
136
  reformat_prompt = f'''
137
- Given the {updated_state}, reformat it into a proper JSON
138
- with only 3 keys: page_name, features, user_data
139
- Follow the format:
140
- {{
141
- "page_name": page_name
142
- "features": {{}},
143
- "user_data": {{
144
- "Data Entry 1": "Details of Data Entry 1",
145
- "Data Entry 2": "Details of Data Entry 2"
146
- }}
147
- }}
148
  '''
149
- self.conversation.append({"role": "assistant", "content": reformat_prompt})
150
- reformat_state = self._get_openai_response(self.conversation)
151
  updated_state = json_repair.loads(reformat_state)
152
 
153
  if updated_state['task_completed']:
 
95
 
96
  # Update user state using GPT's response
97
  update_prompt = f"""
98
+ Update the user state based on user input: '{user_input}' and task: {self.task}
99
 
100
  Current user state (JSON format): {self.user_state}
101
 
 
113
  - Ensure 'current_page' and 'task_completed' are keys in the returned dictionary.
114
  - Return **only the JSON object** without additional output or wrapping.
115
  - **AVOID OUTPUT A LIST**, must be JSON!
 
 
 
 
 
 
 
 
 
 
 
116
  """
117
 
118
  self.conversation.append({"role": "assistant", "content": update_prompt})
 
123
 
124
  if isinstance(updated_state, list):
125
  reformat_prompt = f'''
126
+ Given the {updated_state}, reformat it into a proper JSON.
 
 
 
 
 
 
 
 
 
 
127
  '''
128
+ reformat_state = self._get_openai_response([{"role": "assistant", "content": reformat_prompt}])
 
129
  updated_state = json_repair.loads(reformat_state)
130
 
131
  if updated_state['task_completed']: