openvector_dev 0.1.9__tar.gz → 0.1.11__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.
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/PKG-INFO +1 -1
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/pyproject.toml +1 -1
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/api/facade.py +7 -3
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/qdrant_adapter.py +10 -2
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/README.md +0 -0
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/__init__.py +0 -0
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/api/__init__.py +0 -0
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/bases/__init__.py +0 -0
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/bases/embeding_provider_abc.py +0 -0
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/bases/memory_manager_abc.py +0 -0
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/memory_manager_qdrant.py +0 -0
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/memory_manager_ram.py +0 -0
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/redis_short_term.py +0 -0
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/schemas/__init__.py +0 -0
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/schemas/chunk.py +0 -0
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/sentence_transformer.py +0 -0
- {openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/short_term.py +0 -0
@@ -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
|
-
|
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=[
|
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]]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{openvector_dev-0.1.9 → openvector_dev-0.1.11}/src/lein_vector/bases/embeding_provider_abc.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|