openvector_dev 0.1.9__py3-none-any.whl → 0.1.11__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
@@ -1,5 +1,6 @@
1
1
  from collections.abc import Sequence
2
2
  from datetime import UTC, datetime
3
+ from typing import Optional, Any
3
4
  from uuid import UUID, uuid4
4
5
 
5
6
  import redis.asyncio as aioredis
@@ -114,10 +115,12 @@ class Memory:
114
115
  extra={"msg_no": curr_no},
115
116
  )
116
117
  await self.long.upsert_chunk_with_vector(new_chunk, vector)
117
- # self.short.clear_until(block_size)
118
118
 
119
119
  if curr_no % (block_size * self.merge_n) == 0:
120
- return await self.long.merge_old_chunks(user_id=user_id, bot=bot, chunk_type="type0", n=self.merge_n)
120
+ merged_text, used_ids = await self.long.merge_old_chunks(user_id=user_id, bot=bot, chunk_type="type0", n=self.merge_n)
121
+ return merged_text, used_ids
122
+ else:
123
+ return None, None
121
124
 
122
125
  async def get_long_memories(
123
126
  self, user_id: int, bot: str, search_terms: list[str], topk: int = 3
@@ -218,8 +221,9 @@ class Memory:
218
221
  """
219
222
  Удаляет
220
223
  :param user_id: Идентификатор пользователя.
224
+ :param bot: Codename бота
221
225
  """
222
- await self.long.delete_all(user_id)
226
+ await self.long.delete_all(user_id, bot)
223
227
 
224
228
  @staticmethod
225
229
  def _chunk_texts(chunks: Sequence[Chunk | ChunkPayload]) -> list[str]:
@@ -109,13 +109,21 @@ class QdrantAdapter:
109
109
  async def delete_collection(self) -> None:
110
110
  await self.client.delete_collection(collection_name=self.collection)
111
111
 
112
- async def get_all_chunks(self, user_id: int) -> list[ChunkPayload]:
112
+ async def get_all_chunks(self, user_id: int, bot: str) -> list[ChunkPayload]:
113
+ """
114
+ Вернуть ВСЕ чанки заданного пользователя и конкретного бота.
115
+ """
113
116
  q_filter = Filter(
114
- must=[FieldCondition(key="user_id", match=MatchValue(value=user_id))]
117
+ must=[
118
+ FieldCondition(key="user_id", match=MatchValue(value=user_id)),
119
+ FieldCondition(key="bot", match=MatchValue(value=bot)),
120
+ ]
115
121
  )
122
+
116
123
  scroll = await self.client.scroll(
117
124
  collection_name=self.collection,
118
125
  scroll_filter=q_filter,
119
126
  limit=2048,
120
127
  )
128
+
121
129
  return [ChunkPayload(**p.payload) for p in scroll[0]]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openvector_dev
3
- Version: 0.1.9
3
+ Version: 0.1.11
4
4
  Summary:
5
5
  Author: p00ler
6
6
  Author-email: liveitspain@gmail.com
@@ -1,17 +1,17 @@
1
1
  lein_vector/__init__.py,sha256=ieXy65X4eVzUtSHNvlh00s4aMwKReafNni4s2q68z3Q,496
2
2
  lein_vector/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- lein_vector/api/facade.py,sha256=OC94eCQnkTgq0BycEEaEMX5YUs5EUtACpiLspYcqusk,9651
3
+ lein_vector/api/facade.py,sha256=GyiIaIf0BlCIs8cb7XdHpIhLIABixlWXKGKgo5CYlB4,9784
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=jzb04gnESVRH62QSYhnwsl-HpS6Kci721rPA3_6LSDQ,6382
8
8
  lein_vector/memory_manager_ram.py,sha256=lUATu6U-cZuRHnR6U1L8aJQB8FNK0Wi40vXsZ5fjDgI,6002
9
- lein_vector/qdrant_adapter.py,sha256=uPhYAp0KmYQhY3DF29JMO1JTbM__xDWGlnZZPor3VKI,4193
9
+ lein_vector/qdrant_adapter.py,sha256=CJsGvlDdTf4gGCFZIRzfYDeOT_7pzw8pf4VT_QIYDWg,4466
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
14
  lein_vector/short_term.py,sha256=KFot9r26d9TZYLscVT42V0NwufIQUkx-hftOe2p7qLU,1933
15
- openvector_dev-0.1.9.dist-info/METADATA,sha256=ZnabZl7TnXLZXj7xFqQk5awRGPzFpuyWnDjMyUAx_Z0,3167
16
- openvector_dev-0.1.9.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
17
- openvector_dev-0.1.9.dist-info/RECORD,,
15
+ openvector_dev-0.1.11.dist-info/METADATA,sha256=60HgtLk0KgO_q7FgIh1pfYt_k1z5R-wyyzFsPYztfVY,3168
16
+ openvector_dev-0.1.11.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
17
+ openvector_dev-0.1.11.dist-info/RECORD,,