Skip to content

Commit 794b09d

Browse files
author
Zhe Yu
committed
remove some parameters.
This guarantees a single source-of-truth design: if a parameter can be retrieved from `self._configs`, it should.
1 parent d1ef322 commit 794b09d

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

src/vectorcode/database/base.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from vectorcode.database.types import (
1212
CollectionContent,
1313
CollectionInfo,
14-
QueryOpts,
1514
ResultType,
1615
VectoriseStats,
1716
)
@@ -60,11 +59,9 @@ def __init__(self, configs: Config):
6059
"""
6160
self._configs = configs
6261

63-
async def count(
64-
self, collection_path: str, what: ResultType = ResultType.chunk
65-
) -> int:
62+
async def count(self, what: ResultType = ResultType.chunk) -> int:
6663
"""Returns the chunk count or file count of the given collection, depending on the value passed for `what`."""
67-
collection_content = await self.list(collection_path, what)
64+
collection_content = await self.list(what)
6865
match what:
6966
case ResultType.chunk:
7067
return len(collection_content.chunks)
@@ -74,17 +71,13 @@ async def count(
7471
@abstractmethod
7572
async def query(
7673
self,
77-
collection_path: str,
7874
keywords_embeddings: list[NDArray],
79-
opts: QueryOpts,
8075
) -> Sequence[QueryResult]:
8176
pass
8277

8378
@abstractmethod
8479
async def vectorise(
8580
self,
86-
collection_path: str,
87-
file_path: str,
8881
chunker: TreeSitterChunker | None = None,
8982
embedding_function: EmbeddingFunction | None = None,
9083
) -> VectoriseStats:
@@ -99,21 +92,21 @@ async def list_collections(self) -> Sequence[CollectionInfo]:
9992
pass
10093

10194
@abstractmethod
102-
async def list(
103-
self, collection_path: str, what: Optional[ResultType] = None
104-
) -> CollectionContent:
95+
async def list(self, what: Optional[ResultType] = None) -> CollectionContent:
10596
"""
10697
When `what` is None, this method should populate both `CollectionContent.files` and `CollectionContent.chunks`.
10798
Otherwise, this method may populate only one of them to save waiting time.
10899
"""
109100
pass
110101

111102
@abstractmethod
112-
async def delete(self, collection_path: str, file_path: str | Sequence[str]):
103+
async def delete(
104+
self,
105+
):
113106
pass
114107

115108
@abstractmethod
116-
async def drop(self, collection_path: str):
109+
async def drop(self):
117110
"""
118111
Delete a collection from the database.
119112
"""

0 commit comments

Comments
 (0)