Files
life-echo/api/app/ports/embedding.py

15 lines
421 B
Python
Raw Normal View History

"""EmbeddingProvider port — 文本向量化能力契约。"""
from typing import Protocol, runtime_checkable
@runtime_checkable
class EmbeddingProvider(Protocol):
async def embed_text(self, text: str) -> list[float]:
"""Embed a single text into a vector."""
...
async def embed_texts(self, texts: list[str]) -> list[list[float]]:
"""Embed multiple texts into vectors."""
...