Skip to content

Commit 8544ea4

Browse files
committed
Special cast to SparseModelDescription
1 parent e3d1c70 commit 8544ea4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fastembed/sparse/sparse_text_embedding.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Iterable, Optional, Sequence, Type, Union
1+
from typing import Any, Iterable, Optional, Sequence, Type, Union, cast
22

33
from fastembed.common import OnnxProvider
44
from fastembed.sparse.bm25 import Bm25
@@ -9,14 +9,14 @@
99
)
1010
from fastembed.sparse.splade_pp import SpladePP
1111
import warnings
12-
from fastembed.common.model_description import ModelDescription
12+
from fastembed.common.model_description import SparseModelDescription
1313

1414

1515
class SparseTextEmbedding(SparseTextEmbeddingBase):
1616
EMBEDDINGS_REGISTRY: list[Type[SparseTextEmbeddingBase]] = [SpladePP, Bm42, Bm25]
1717

1818
@classmethod
19-
def list_supported_models(cls) -> list[ModelDescription]:
19+
def list_supported_models(cls) -> list[SparseModelDescription]:
2020
"""
2121
Lists the supported models.
2222
@@ -39,9 +39,9 @@ def list_supported_models(cls) -> list[ModelDescription]:
3939
]
4040
```
4141
"""
42-
result: list[ModelDescription] = []
42+
result: list[SparseModelDescription] = []
4343
for embedding in cls.EMBEDDINGS_REGISTRY:
44-
result.extend(embedding.list_supported_models())
44+
result.extend(cast(list[SparseModelDescription], embedding.list_supported_models()))
4545
return result
4646

4747
def __init__(

0 commit comments

Comments
 (0)