Tonic commited on
Commit
b510b99
1 Parent(s): 75cae88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -279,12 +279,20 @@ def process_and_query(text=None):
279
  # text = "the user asks the following to his health adviser " + text
280
 
281
 
282
- # Now, use the text (either provided by the user or obtained from OpenAI) to query Vectara
 
283
  vectara_response_json = query_vectara(text)
 
 
284
  markdown_output = convert_to_markdown(vectara_response_json)
285
- client = OpenAI()
286
- prompt ="Answer in the same language, write it better,remove the sources, more understandable and make it 2 line answer:"
287
- markdown_output_final = markdown_output
 
 
 
 
 
288
 
289
  completion = client.chat.completions.create(
290
  model="gpt-3.5-turbo",
 
279
  # text = "the user asks the following to his health adviser " + text
280
 
281
 
282
+
283
+ # Use the text to query Vectara
284
  vectara_response_json = query_vectara(text)
285
+
286
+ # Convert the Vectara response to Markdown
287
  markdown_output = convert_to_markdown(vectara_response_json)
288
+
289
+ # Process the summary with OpenAI
290
+ final_response = process_summary_with_openai(markdown_output)
291
+
292
+ # Return the processed summary along with the full output
293
+ return f"**Summary**: {final_response}\n\n**Full output**:\n{markdown_output}"
294
+ except Exception as e:
295
+ return str(e)
296
 
297
  completion = client.chat.completions.create(
298
  model="gpt-3.5-turbo",