ragtools 0.2.0__tar.gz → 0.2.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ragtools
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Add your description here
5
5
  Author: Wannes Vantorre
6
6
  Author-email: Wannes Vantorre <vantorrewannes@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ragtools"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.14"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ragtools"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -138,11 +138,11 @@ class SparseEmbeddingIndex[K: Hashable]:
138
138
  def keys(self) -> builtins.set[K]:
139
139
  return builtins.set(self._row_of)
140
140
 
141
- def closest(self, key: K, k: int) -> tuple[K, ...]:
141
+ def closest(self, key: K, k: int) -> list[K]:
142
142
  if key not in self._row_of:
143
143
  raise KeyError(key)
144
144
  if k <= 0 or len(self._rows) <= 1 or len(self._vocab) == 0:
145
- return ()
145
+ return []
146
146
  r = self._row_of[key]
147
147
  start, end = int(self._indptr[r]), int(self._indptr[r + 1])
148
148
  q = np.zeros(len(self._vocab), dtype=np.float32)
@@ -153,7 +153,7 @@ class SparseEmbeddingIndex[K: Hashable]:
153
153
  k_eff = min(k, len(self._rows) - 1)
154
154
  top = np.argpartition(-scores, k_eff - 1)[:k_eff]
155
155
  top = top[np.argsort(-scores[top], kind="stable")]
156
- return tuple(self._rows[i] for i in top if scores[i] != -np.inf)
156
+ return [self._rows[i] for i in top if scores[i] != -np.inf]
157
157
 
158
158
  @property
159
159
  def _matrix(self) -> csr_matrix:
File without changes
File without changes