Skip to content

Commit da864cd

Browse files
fix: binary faiss type hints
Signed-off-by: thiswillbeyourgithub <[email protected]>
1 parent 9a4a69c commit da864cd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

wdoc/utils/customs/binary_faiss_vectorstore.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@
4545

4646
logger = logging.getLogger(__name__)
4747

48-
UInt8Array: TypeAlias = npt.NDArray[np.uint8] # 2D
49-
UInt8Vector: TypeAlias = npt.NDArray[np.uint8] # 1D
48+
NDArray = npt.NDArray # required for beartype
49+
UInt8Array: TypeAlias = NDArray[np.uint8] # 2D
50+
UInt8Vector: TypeAlias = NDArray[np.uint8] # 1D
5051

5152

5253
class CompressedFAISS(FAISS):
@@ -315,7 +316,7 @@ async def new_aembedding_function(self, texts: List[str]) -> UInt8Array:
315316

316317
@staticmethod
317318
def _vec_to_binary(
318-
vectors: Union[np.ndarray[np.float32], List[float], List[List[float]]],
319+
vectors: Union[NDArray[np.float32], List[float], List[List[float]]],
319320
) -> UInt8Array:
320321
"""Convert vectors to binary format using global zero threshold.
321322

0 commit comments

Comments
 (0)