Spaces:
Runtime error
Runtime error
update openai summary
Browse files
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'
|
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
|
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 |
|