openvector_dev 0.1.25__tar.gz → 0.1.26__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openvector_dev
3
- Version: 0.1.25
3
+ Version: 0.1.26
4
4
  Summary:
5
5
  Author: p00ler
6
6
  Author-email: liveitspain@gmail.com
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "openvector_dev"
3
- version = "0.1.25"
3
+ version = "0.1.26"
4
4
  description = ""
5
5
  authors = [
6
6
  {name = "p00ler",email = "liveitspain@gmail.com"}
@@ -139,21 +139,28 @@ class QdrantAdapter:
139
139
  bot: str,
140
140
  chunk_type: str,
141
141
  n: int = 5,
142
- ):
143
- q_filter = Filter(
142
+ ) -> list[ChunkPayload]:
143
+ flt = Filter(
144
144
  must=[
145
145
  FieldCondition(key="user_id", match=MatchValue(value=user_id)),
146
146
  FieldCondition(key="bot", match=MatchValue(value=bot)),
147
147
  FieldCondition(key="chunk_type", match=MatchValue(value=chunk_type)),
148
148
  ]
149
149
  )
150
- hits = await self.client.search(
150
+
151
+ # собираем все подходящие точки одной командой
152
+ points, _ = await self.client.scroll(
151
153
  collection_name=self.collection,
152
- query_vector=None,
153
- query_filter=q_filter,
154
- limit=n,
154
+ scroll_filter=flt,
155
155
  with_payload=True,
156
156
  with_vectors=False,
157
- offset=0,
157
+ limit=10_00,
158
+ )
159
+
160
+ # сортируем по времени создания
161
+ sorted_points = sorted(
162
+ (ChunkPayload(**p.payload) for p in points),
163
+ key=lambda p: p.created_at,
158
164
  )
159
- return [ChunkPayload(**h.payload) for h in hits]
165
+
166
+ return sorted_points[:n]