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.
- {ragtools-0.2.0 → ragtools-0.2.1}/PKG-INFO +1 -1
- {ragtools-0.2.0 → ragtools-0.2.1}/pyproject.toml +1 -1
- {ragtools-0.2.0 → ragtools-0.2.1}/pyproject.toml.orig +1 -1
- {ragtools-0.2.0 → ragtools-0.2.1}/src/ragtools/indexes.py +3 -3
- {ragtools-0.2.0 → ragtools-0.2.1}/README.md +0 -0
- {ragtools-0.2.0 → ragtools-0.2.1}/src/ragtools/__init__.py +0 -0
- {ragtools-0.2.0 → ragtools-0.2.1}/src/ragtools/embedders.py +0 -0
- {ragtools-0.2.0 → ragtools-0.2.1}/src/ragtools/fusers.py +0 -0
- {ragtools-0.2.0 → ragtools-0.2.1}/src/ragtools/generators.py +0 -0
- {ragtools-0.2.0 → ragtools-0.2.1}/src/ragtools/parsers.py +0 -0
- {ragtools-0.2.0 → ragtools-0.2.1}/src/ragtools/py.typed +0 -0
- {ragtools-0.2.0 → ragtools-0.2.1}/src/ragtools/scorers.py +0 -0
- {ragtools-0.2.0 → ragtools-0.2.1}/src/ragtools/stores.py +0 -0
|
@@ -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) ->
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|