Spaces:
Sleeping
Sleeping
Commit
·
a843121
1
Parent(s):
afbeab2
feat : pass results to metadata - avoid sending too much data to LLM
Browse files- sorbobotapp/app.py +4 -3
- sorbobotapp/vector_store.py +7 -5
sorbobotapp/app.py
CHANGED
@@ -160,10 +160,11 @@ with doc_column:
|
|
160 |
if len(st.session_state.history) > 0:
|
161 |
for doc in st.session_state.history[-1].documents:
|
162 |
doc_content = json.loads(doc.page_content)
|
|
|
163 |
|
164 |
expander = st.expander(doc_content["title"])
|
165 |
-
expander.markdown(f"**HalID** : https://hal.science/{
|
166 |
-
expander.markdown(
|
167 |
expander.markdown(f"**Authors** : {doc_content['authors']}")
|
168 |
expander.markdown(f"**Keywords** : {doc_content['keywords']}")
|
169 |
-
expander.markdown(f"**Distance** : {
|
|
|
160 |
if len(st.session_state.history) > 0:
|
161 |
for doc in st.session_state.history[-1].documents:
|
162 |
doc_content = json.loads(doc.page_content)
|
163 |
+
doc_metadata = doc.metadata
|
164 |
|
165 |
expander = st.expander(doc_content["title"])
|
166 |
+
expander.markdown(f"**HalID** : https://hal.science/{doc_metadata['hal_id']}")
|
167 |
+
expander.markdown(doc_metadata["abstract"])
|
168 |
expander.markdown(f"**Authors** : {doc_content['authors']}")
|
169 |
expander.markdown(f"**Keywords** : {doc_content['keywords']}")
|
170 |
+
expander.markdown(f"**Distance** : {doc_metadata['distance']}")
|
sorbobotapp/vector_store.py
CHANGED
@@ -229,16 +229,18 @@ class CustomVectorStore(VectorStore):
|
|
229 |
Document(
|
230 |
page_content=json.dumps(
|
231 |
{
|
232 |
-
"abstract": result["abstract"][0],
|
233 |
-
"id": result["id"],
|
234 |
"title": result["title"][0],
|
235 |
"authors": result["authors"],
|
236 |
-
"doi": result["doi"],
|
237 |
-
"hal_id": result["hal_id"],
|
238 |
"keywords": result["keywords"],
|
239 |
-
"distance": result["distance"],
|
240 |
}
|
241 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
),
|
243 |
result["distance"] if self.embedding_function is not None else None,
|
244 |
)
|
|
|
229 |
Document(
|
230 |
page_content=json.dumps(
|
231 |
{
|
|
|
|
|
232 |
"title": result["title"][0],
|
233 |
"authors": result["authors"],
|
|
|
|
|
234 |
"keywords": result["keywords"],
|
|
|
235 |
}
|
236 |
),
|
237 |
+
metadata={
|
238 |
+
"id": result["id"],
|
239 |
+
"doi": result["doi"],
|
240 |
+
"hal_id": result["hal_id"],
|
241 |
+
"distance": result["distance"],
|
242 |
+
"abstract": result["abstract"],
|
243 |
+
},
|
244 |
),
|
245 |
result["distance"] if self.embedding_function is not None else None,
|
246 |
)
|