openvector_dev 0.1.9__py3-none-any.whl → 0.1.10__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 +5 -2
- lein_vector/qdrant_adapter.py +10 -2
- {openvector_dev-0.1.9.dist-info → openvector_dev-0.1.10.dist-info}/METADATA +1 -1
- {openvector_dev-0.1.9.dist-info → openvector_dev-0.1.10.dist-info}/RECORD +5 -5
- {openvector_dev-0.1.9.dist-info → openvector_dev-0.1.10.dist-info}/WHEEL +0 -0
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,11 @@ 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
120
|
return await self.long.merge_old_chunks(user_id=user_id, bot=bot, chunk_type="type0", n=self.merge_n)
|
121
|
+
else:
|
122
|
+
return None, None
|
121
123
|
|
122
124
|
async def get_long_memories(
|
123
125
|
self, user_id: int, bot: str, search_terms: list[str], topk: int = 3
|
@@ -218,8 +220,9 @@ class Memory:
|
|
218
220
|
"""
|
219
221
|
Удаляет
|
220
222
|
:param user_id: Идентификатор пользователя.
|
223
|
+
:param bot: Codename бота
|
221
224
|
"""
|
222
|
-
await self.long.delete_all(user_id)
|
225
|
+
await self.long.delete_all(user_id, bot)
|
223
226
|
|
224
227
|
@staticmethod
|
225
228
|
def _chunk_texts(chunks: Sequence[Chunk | ChunkPayload]) -> list[str]:
|
lein_vector/qdrant_adapter.py
CHANGED
@@ -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=[
|
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,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=
|
3
|
+
lein_vector/api/facade.py,sha256=Z5jHOoU4iYiJ3hGrhpOEJbJvx_grp2YLgmeQbuCrkTo,9725
|
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=
|
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.
|
16
|
-
openvector_dev-0.1.
|
17
|
-
openvector_dev-0.1.
|
15
|
+
openvector_dev-0.1.10.dist-info/METADATA,sha256=KxlvCA-i9l8m4M8e_6aVRWW8FFTiwo5UYSAhz6k3uwM,3168
|
16
|
+
openvector_dev-0.1.10.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
17
|
+
openvector_dev-0.1.10.dist-info/RECORD,,
|
File without changes
|