Fix linting
This commit is contained in:
@@ -115,6 +115,7 @@ class ChromaVectorDBStorage(BaseVectorStorage):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import time
|
import time
|
||||||
|
|
||||||
current_time = int(time.time())
|
current_time = int(time.time())
|
||||||
|
|
||||||
ids = list(data.keys())
|
ids = list(data.keys())
|
||||||
|
@@ -425,7 +425,11 @@ class FaissVectorDBStorage(BaseVectorStorage):
|
|||||||
if not metadata:
|
if not metadata:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return {**metadata, "id": metadata.get("__id__"), "created_at": metadata.get("__created_at__")}
|
return {
|
||||||
|
**metadata,
|
||||||
|
"id": metadata.get("__id__"),
|
||||||
|
"created_at": metadata.get("__created_at__"),
|
||||||
|
}
|
||||||
|
|
||||||
async def get_by_ids(self, ids: list[str]) -> list[dict[str, Any]]:
|
async def get_by_ids(self, ids: list[str]) -> list[dict[str, Any]]:
|
||||||
"""Get multiple vector data by their IDs
|
"""Get multiple vector data by their IDs
|
||||||
@@ -445,7 +449,13 @@ class FaissVectorDBStorage(BaseVectorStorage):
|
|||||||
if fid is not None:
|
if fid is not None:
|
||||||
metadata = self._id_to_meta.get(fid, {})
|
metadata = self._id_to_meta.get(fid, {})
|
||||||
if metadata:
|
if metadata:
|
||||||
results.append({**metadata, "id": metadata.get("__id__"), "created_at": metadata.get("__created_at__")})
|
results.append(
|
||||||
|
{
|
||||||
|
**metadata,
|
||||||
|
"id": metadata.get("__id__"),
|
||||||
|
"created_at": metadata.get("__created_at__"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
@@ -80,6 +80,7 @@ class MilvusVectorDBStorage(BaseVectorStorage):
|
|||||||
return
|
return
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
current_time = int(time.time())
|
current_time = int(time.time())
|
||||||
|
|
||||||
list_data: list[dict[str, Any]] = [
|
list_data: list[dict[str, Any]] = [
|
||||||
@@ -127,7 +128,7 @@ class MilvusVectorDBStorage(BaseVectorStorage):
|
|||||||
**dp["entity"],
|
**dp["entity"],
|
||||||
"id": dp["id"],
|
"id": dp["id"],
|
||||||
"distance": dp["distance"],
|
"distance": dp["distance"],
|
||||||
"created_at": dp["entity"].get("created_at")
|
"created_at": dp["entity"].get("created_at"),
|
||||||
}
|
}
|
||||||
for dp in results[0]
|
for dp in results[0]
|
||||||
]
|
]
|
||||||
|
@@ -1001,6 +1001,7 @@ class MongoVectorDBStorage(BaseVectorStorage):
|
|||||||
|
|
||||||
# Add current time as Unix timestamp
|
# Add current time as Unix timestamp
|
||||||
import time
|
import time
|
||||||
|
|
||||||
current_time = int(time.time())
|
current_time = int(time.time())
|
||||||
|
|
||||||
list_data = [
|
list_data = [
|
||||||
@@ -1070,7 +1071,7 @@ class MongoVectorDBStorage(BaseVectorStorage):
|
|||||||
**doc,
|
**doc,
|
||||||
"id": doc["_id"],
|
"id": doc["_id"],
|
||||||
"distance": doc.get("score", None),
|
"distance": doc.get("score", None),
|
||||||
"created_at": doc.get("created_at") # Include created_at field
|
"created_at": doc.get("created_at"), # Include created_at field
|
||||||
}
|
}
|
||||||
for doc in results
|
for doc in results
|
||||||
]
|
]
|
||||||
@@ -1167,7 +1168,7 @@ class MongoVectorDBStorage(BaseVectorStorage):
|
|||||||
{
|
{
|
||||||
**doc,
|
**doc,
|
||||||
"id": doc["_id"],
|
"id": doc["_id"],
|
||||||
"created_at": doc.get("created_at") # Include created_at field
|
"created_at": doc.get("created_at"), # Include created_at field
|
||||||
}
|
}
|
||||||
for doc in matching_records
|
for doc in matching_records
|
||||||
]
|
]
|
||||||
|
@@ -90,6 +90,7 @@ class QdrantVectorDBStorage(BaseVectorStorage):
|
|||||||
return
|
return
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
current_time = int(time.time())
|
current_time = int(time.time())
|
||||||
|
|
||||||
list_data = [
|
list_data = [
|
||||||
@@ -146,7 +147,7 @@ class QdrantVectorDBStorage(BaseVectorStorage):
|
|||||||
{
|
{
|
||||||
**dp.payload,
|
**dp.payload,
|
||||||
"distance": dp.score,
|
"distance": dp.score,
|
||||||
"created_at": dp.payload.get("created_at")
|
"created_at": dp.payload.get("created_at"),
|
||||||
}
|
}
|
||||||
for dp in results
|
for dp in results
|
||||||
]
|
]
|
||||||
|
Reference in New Issue
Block a user