openvector_dev 0.1.14__py3-none-any.whl → 0.1.16__py3-none-any.whl

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.
lein_vector/api/facade.py CHANGED
@@ -243,12 +243,22 @@ class Memory:
243
243
 
244
244
  async def delete_memory(self, user_id: int, bot: str) -> None:
245
245
  """
246
- Удаляет
247
- :param user_id: Идентификатор пользователя.
248
- :param bot: Codename бота
246
+ Полная очистка памяти данного (user_id, bot):
247
+ short-term (Redis)
248
+ long-term (Qdrant)
249
+ • внутренние счётчики фасада (_msg_no, _gift_fail)
249
250
  """
251
+ # 1) short-term (Redis list)
252
+ await self.short.clear(user_id=user_id, bot=bot)
253
+
254
+ # 2) long-term (Qdrant)
250
255
  await self.long.delete_all(user_id, bot)
251
256
 
257
+ # 3) локальные счётчики
258
+ self._msg_no.pop((user_id, bot), None)
259
+ self._gift_fail.pop((user_id, bot), None)
260
+
261
+
252
262
  @staticmethod
253
263
  def _chunk_texts(chunks: Sequence[Chunk | ChunkPayload]) -> list[str]:
254
264
  """
@@ -127,3 +127,28 @@ class QdrantAdapter:
127
127
  )
128
128
 
129
129
  return [ChunkPayload(**p.payload) for p in scroll[0]]
130
+
131
+ async def get_n_oldest_chunks(
132
+ self,
133
+ user_id: int,
134
+ bot: str,
135
+ chunk_type: str,
136
+ n: int = 5,
137
+ ):
138
+ q_filter = Filter(
139
+ must=[
140
+ FieldCondition(key="user_id", match=MatchValue(value=user_id)),
141
+ FieldCondition(key="bot", match=MatchValue(value=bot)),
142
+ FieldCondition(key="chunk_type", match=MatchValue(value=chunk_type)),
143
+ ]
144
+ )
145
+ hits = await self.client.search(
146
+ collection_name=self.collection,
147
+ query_vector=None, # режим «scroll без вектора»
148
+ query_filter=q_filter,
149
+ limit=n,
150
+ with_payload=True,
151
+ with_vectors=False,
152
+ offset=0,
153
+ )
154
+ return [ChunkPayload(**h.payload) for h in hits]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openvector_dev
3
- Version: 0.1.14
3
+ Version: 0.1.16
4
4
  Summary:
5
5
  Author: p00ler
6
6
  Author-email: liveitspain@gmail.com
@@ -1,16 +1,16 @@
1
1
  lein_vector/__init__.py,sha256=48LqJbNqEEpbTFDkXA4BoF7KZ7z8FAKdj9NJ_raKJxk,431
2
2
  lein_vector/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- lein_vector/api/facade.py,sha256=PpzGUEiCOoApLWtXVB4RTYV9I16ajU_R6_-24kJt6Ug,10237
3
+ lein_vector/api/facade.py,sha256=GcHTRyflyk0LihI2mrZaV_q-nfGL4i9-3S2zBcG2J3s,10621
4
4
  lein_vector/bases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  lein_vector/bases/embeding_provider_abc.py,sha256=WBpVC6ra-SYqhJeZs8R8U679wfGebXgwOOVPIii-IvY,265
6
6
  lein_vector/bases/memory_manager_abc.py,sha256=NE13Lz-3aX3RjkRhsd5FsezPNk0xju34fFpO3Fa1n9A,1755
7
7
  lein_vector/memory_manager_qdrant.py,sha256=K41sbRYz168-yYO9cb9DOl7XWc7nGfWGFvcEz0iu3KE,6369
8
8
  lein_vector/memory_manager_ram.py,sha256=lUATu6U-cZuRHnR6U1L8aJQB8FNK0Wi40vXsZ5fjDgI,6002
9
- lein_vector/qdrant_adapter.py,sha256=CJsGvlDdTf4gGCFZIRzfYDeOT_7pzw8pf4VT_QIYDWg,4466
9
+ lein_vector/qdrant_adapter.py,sha256=8Ot9OmQCjy5H8r0V09WNagUUfeKGI0Xm8rO2t9ykU9Y,5333
10
10
  lein_vector/redis_short_term.py,sha256=uCcncjgXAlNAY46b3_Pjvrn_G0NEI16kRRR9hxayzak,3155
11
11
  lein_vector/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  lein_vector/schemas/chunk.py,sha256=qq2J7UM94AhKXKg_gnErac5GQF9DCoaEeEHyxZg_xuk,1202
13
13
  lein_vector/sentence_transformer.py,sha256=SjjIa43Y7JxcU9VkpT2Ml-CVXb8tqmrbMutZN6O_I6s,1853
14
- openvector_dev-0.1.14.dist-info/METADATA,sha256=oKKk2vWWDCgqs9-MGwgGhsKcrOtMbNRCgPNk02bKIpA,3168
15
- openvector_dev-0.1.14.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
16
- openvector_dev-0.1.14.dist-info/RECORD,,
14
+ openvector_dev-0.1.16.dist-info/METADATA,sha256=uIPyYuaz8cqO7D89JJH02GfO0hEcq0tsZbCAlR6tBN0,3168
15
+ openvector_dev-0.1.16.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
16
+ openvector_dev-0.1.16.dist-info/RECORD,,