refactor: 修复 Embedder Protocol 标准写法和 PDF/EPUB Splitter 参数语义

This commit is contained in:
2026-07-11 19:53:08 +08:00
parent 2d0e8c4997
commit 04f2f8a8a8
4 changed files with 24 additions and 11 deletions
+15 -2
View File
@@ -48,9 +48,22 @@ _PROVIDER_DEFAULTS: dict[str, dict[str, str | int]] = {
# -- 接口 --
class Embedder(Protocol):
"""嵌入器接口."""
@property
def dimension(self) -> int: ...
def embed(self, texts: list[str]) -> list[list[float]]: ...
def dimension(self) -> int:
"""返回嵌入向量的维度."""
...
def embed(self, texts: list[str]) -> list[list[float]]:
"""对文本列表进行嵌入.
Args:
texts: 待嵌入的文本列表
Returns:
嵌入向量列表,每个向量为 float 列表
"""
...
# -- 本地模型 --