not-lain Roo-Kh commited on
Commit
7bc7c93
1 Parent(s): 1ffa7d4

update openai summary (#6)

Browse files

- update openai summary (e985809b49b8b4540e73bf738c56d780a29e32ed)


Co-authored-by: Rawan <[email protected]>

Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -212,7 +212,7 @@ def convert_to_markdown(vectara_response_json):
212
  sources_info = vectara_response.get('sources', [])
213
 
214
  # Format the summary as Markdown
215
- markdown_summary = f'**Summary:** {summary}\n\n'
216
 
217
  # Format the sources as a numbered list
218
  markdown_sources = ""
@@ -246,7 +246,7 @@ def process_and_query(text=None):
246
  vectara_response_json = query_vectara(text)
247
  markdown_output = convert_to_markdown(vectara_response_json)
248
  client = OpenAI()
249
- prompt ="Answer in the same language, write it better, more understandable and shorter:"
250
  markdown_output_final = markdown_output
251
 
252
  completion = client.chat.completions.create(
@@ -257,7 +257,7 @@ def process_and_query(text=None):
257
  ]
258
  )
259
  final_response= completion.choices[0].message.content
260
- return final_response
261
  except Exception as e:
262
  return str(e)
263
 
 
212
  sources_info = vectara_response.get('sources', [])
213
 
214
  # Format the summary as Markdown
215
+ markdown_summary = f' {summary}\n\n'
216
 
217
  # Format the sources as a numbered list
218
  markdown_sources = ""
 
246
  vectara_response_json = query_vectara(text)
247
  markdown_output = convert_to_markdown(vectara_response_json)
248
  client = OpenAI()
249
+ prompt ="Answer in the same language, write it better,remove the sources, more understandable and make it 2 line answer:"
250
  markdown_output_final = markdown_output
251
 
252
  completion = client.chat.completions.create(
 
257
  ]
258
  )
259
  final_response= completion.choices[0].message.content
260
+ return f"**Summary**: {final_response}\n\n**Full output**:\n{markdown_output}"
261
  except Exception as e:
262
  return str(e)
263