Spaces:
Runtime error
Runtime error
Abhilashvj
commited on
Commit
•
df49b45
1
Parent(s):
5ddd6eb
Update app.py
Browse files
app.py
CHANGED
@@ -76,7 +76,7 @@ def retrieve(query):
|
|
76 |
|
77 |
# get relevant contexts
|
78 |
res = index.query(xq, top_k=3, include_metadata=True)
|
79 |
-
contexts = [x["metadata"]
|
80 |
|
81 |
# build our prompt with the retrieved contexts included
|
82 |
prompt_start = "Answer the question based on the context below.\n\n" + "Context:\n"
|
@@ -325,7 +325,7 @@ if st.session_state.results:
|
|
325 |
# )
|
326 |
all_contexts = '\n'.join(contexts)
|
327 |
st.write(
|
328 |
-
markdown(f"Answer: {result} \n Extracted from context {all_contexts}"),
|
329 |
unsafe_allow_html=True,
|
330 |
)
|
331 |
except:
|
|
|
76 |
|
77 |
# get relevant contexts
|
78 |
res = index.query(xq, top_k=3, include_metadata=True)
|
79 |
+
contexts = [x["metadata"].get("text", "") for x in res["matches"]]
|
80 |
|
81 |
# build our prompt with the retrieved contexts included
|
82 |
prompt_start = "Answer the question based on the context below.\n\n" + "Context:\n"
|
|
|
325 |
# )
|
326 |
all_contexts = '\n'.join(contexts)
|
327 |
st.write(
|
328 |
+
markdown(f"# Answer: {result} \n ## Extracted from context: \n {all_contexts}"),
|
329 |
unsafe_allow_html=True,
|
330 |
)
|
331 |
except:
|