ankur-bohra commited on
Commit
5a4f643
·
1 Parent(s): 85054c1

Fix message order

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -126,14 +126,15 @@ def parse_from_category(category, extracted_text):
126
  )
127
  question = f""
128
  if len(formatted_prompt.messages) > 1:
129
- question += f"**System:**\n{formatted_prompt.messages[1].content}"
130
- question += f"\n\n**Human:**\n{formatted_prompt.messages[0].content}"
131
  print("\tConstructed prompt")
132
  answer = result.generations[0][0].text
133
  print("\tProcessed text")
134
  try:
135
- information = chain.output_parser.parse_with_prompt(answer, formatted_prompt)
136
  information = information.json() if information else {}
 
137
  except OutputParserException as e:
138
  information = {
139
  "error": "Unable to parse chatbot output",
 
126
  )
127
  question = f""
128
  if len(formatted_prompt.messages) > 1:
129
+ question += f"**System:**\n{formatted_prompt.messages[0].content}"
130
+ question += f"\n\n**Human:**\n{formatted_prompt.messages[1].content}"
131
  print("\tConstructed prompt")
132
  answer = result.generations[0][0].text
133
  print("\tProcessed text")
134
  try:
135
+ information = chain.output_parser.parse_with_prompt(answer)
136
  information = information.json() if information else {}
137
+ information['retry'] = True
138
  except OutputParserException as e:
139
  information = {
140
  "error": "Unable to parse chatbot output",