Spaces:
Sleeping
Sleeping
Kieran Gookey
commited on
Commit
·
df26c41
1
Parent(s):
d33a2d5
Added retriever too
Browse files
app.py
CHANGED
|
@@ -43,9 +43,19 @@ if html_file is not None:
|
|
| 43 |
index = VectorStoreIndex.from_documents(
|
| 44 |
documents, show_progress=True, metadata={"source": "HTML"}, service_context=service_context)
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
query_engine = index.as_query_engine(
|
| 47 |
filters=filters, service_context=service_context)
|
| 48 |
|
| 49 |
-
response = query_engine.query(
|
|
|
|
| 50 |
|
| 51 |
st.write(response)
|
|
|
|
| 43 |
index = VectorStoreIndex.from_documents(
|
| 44 |
documents, show_progress=True, metadata={"source": "HTML"}, service_context=service_context)
|
| 45 |
|
| 46 |
+
retriever = index.as_retriever()
|
| 47 |
+
|
| 48 |
+
ranked_nodes = retriever.retrieve(
|
| 49 |
+
"Get me all the information about the product")
|
| 50 |
+
|
| 51 |
+
with st.expander("Ranked Nodes"):
|
| 52 |
+
for node in ranked_nodes:
|
| 53 |
+
st.write(node.node.get_content(), "-> Score:", node.score)
|
| 54 |
+
|
| 55 |
query_engine = index.as_query_engine(
|
| 56 |
filters=filters, service_context=service_context)
|
| 57 |
|
| 58 |
+
response = query_engine.query(
|
| 59 |
+
"Get me all the information about the product")
|
| 60 |
|
| 61 |
st.write(response)
|