Spaces:
Sleeping
Sleeping
Commit
·
7c0a7ae
1
Parent(s):
722a601
clean: format custom pgvector
Browse files- custom_pgvector.py +13 -13
custom_pgvector.py
CHANGED
@@ -283,9 +283,7 @@ class CustomPGVector(VectorStore):
|
|
283 |
List of Documents most similar to the query and score for each.
|
284 |
"""
|
285 |
embedding = self.embedding_function.embed_query(query)
|
286 |
-
docs = self.similarity_search_with_score_by_vector(
|
287 |
-
embedding=embedding, k=k
|
288 |
-
)
|
289 |
return docs
|
290 |
|
291 |
@property
|
@@ -316,16 +314,18 @@ class CustomPGVector(VectorStore):
|
|
316 |
docs = [
|
317 |
(
|
318 |
Document(
|
319 |
-
page_content=json.dumps(
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
|
|
|
|
329 |
),
|
330 |
result["distance"] if self.embedding_function is not None else None,
|
331 |
)
|
|
|
283 |
List of Documents most similar to the query and score for each.
|
284 |
"""
|
285 |
embedding = self.embedding_function.embed_query(query)
|
286 |
+
docs = self.similarity_search_with_score_by_vector(embedding=embedding, k=k)
|
|
|
|
|
287 |
return docs
|
288 |
|
289 |
@property
|
|
|
314 |
docs = [
|
315 |
(
|
316 |
Document(
|
317 |
+
page_content=json.dumps(
|
318 |
+
{
|
319 |
+
"abstract": result["abstract"],
|
320 |
+
"id": result["id"],
|
321 |
+
"title": result["title"],
|
322 |
+
"authors": result["authors"],
|
323 |
+
"doi": result["doi"],
|
324 |
+
# "halID": result["halID"],
|
325 |
+
"keywords": result["keywords"],
|
326 |
+
"distance": result["distance"],
|
327 |
+
}
|
328 |
+
),
|
329 |
),
|
330 |
result["distance"] if self.embedding_function is not None else None,
|
331 |
)
|