Skip to content

Commit 03b79a2

Browse files
authored
feat: update code format (MemTensor#814)
* fix: code * feat:change qdrant test * feat: code format
1 parent 7993c3a commit 03b79a2

3 files changed

Lines changed: 24 additions & 12 deletions

File tree

poetry.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/memos/chunkers/sentence_chunker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, config: SentenceChunkerConfig):
2020
from chonkie import SentenceChunker as ChonkieSentenceChunker
2121

2222
self.config = config
23-
23+
2424
# Try new API first (v1.4.0+)
2525
try:
2626
self.chunker = ChonkieSentenceChunker(
@@ -38,7 +38,7 @@ def __init__(self, config: SentenceChunkerConfig):
3838
chunk_overlap=config.chunk_overlap,
3939
min_sentences_per_chunk=config.min_sentences_per_chunk,
4040
)
41-
41+
4242
logger.info(f"Initialized SentenceChunker with config: {config}")
4343

4444
def chunk(self, text: str) -> list[str] | list[Chunk]:

tests/vec_dbs/test_qdrant.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,25 @@ def test_add_and_get_by_id(vec_db):
7070

7171
def test_search(vec_db):
7272
id = str(uuid.uuid4())
73-
vec_db.client.search.return_value = [
74-
type(
75-
"obj",
76-
(object,),
77-
{"id": id, "vector": [0.1, 0.2, 0.3], "payload": {"tag": "search"}, "score": 0.9},
78-
)
79-
]
73+
mock_response = type(
74+
"QueryResponse",
75+
(object,),
76+
{
77+
"points": [
78+
type(
79+
"obj",
80+
(object,),
81+
{
82+
"id": id,
83+
"vector": [0.1, 0.2, 0.3],
84+
"payload": {"tag": "search"},
85+
"score": 0.9,
86+
},
87+
)
88+
]
89+
},
90+
)()
91+
vec_db.client.query_points.return_value = mock_response
8092
results = vec_db.search([0.1, 0.2, 0.3], top_k=1)
8193
assert len(results) == 1
8294
assert isinstance(results[0], VecDBItem)

0 commit comments

Comments
 (0)