openvector_dev 0.1.24__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.24
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.24"
3
+ version = "0.1.26"
4
4
  description = ""
5
5
  authors = [
6
6
  {name = "p00ler",email = "liveitspain@gmail.com"}
@@ -142,6 +142,7 @@ class Memory:
142
142
  await self.long.upsert_chunk_with_vector(new_chunk, vector)
143
143
 
144
144
  if curr_no % (block_size * self.merge_n) == 0:
145
+ log.debug(f'Summary requested {bot}:{user_id}')
145
146
  merged_text, used_ids = await self.long.merge_old_chunks(
146
147
  user_id=user_id, bot=bot, chunk_type="type0", n=self.merge_n
147
148
  )
@@ -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]