Skip to content

cayu.embeddings

Public Cayu API. Definitions are grouped by their public source module, and definitions from private implementation modules appear on their package’s page; adding a symbol does not move existing links. The import shown at each entry is a supported public namespace. Read the Python API overview and install the required extra.

from cayu import TextEmbedding

One embedding vector returned by a provider.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
index int required
vector list[float] required
TextEmbedding.validate_index(value: int, info) -> int
TextEmbedding.validate_vector(value: list[float], info) -> list[float]

Release source · Runtime guarantees · Capability guides

from cayu import TextEmbeddingProvider

Provider-neutral text embedding contract.

Bases: ABC.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
name str required
async TextEmbeddingProvider.embed_texts(request: TextEmbeddingRequest) -> TextEmbeddingResult

Embed text inputs and return one vector for each input.

Release source · Runtime guarantees · Capability guides

from cayu import TextEmbeddingRequest

Provider-neutral request to embed one or more text inputs.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
model str required
texts list[str] required
dimensions int | None None
options dict[str, Any] Field(default_factory=dict)
TextEmbeddingRequest.validate_model(value: str, info) -> str
TextEmbeddingRequest.validate_texts(value: list[str], info) -> list[str]
TextEmbeddingRequest.validate_dimensions(value: int | None, info) -> int | None
TextEmbeddingRequest.copy_options(value: dict[str, Any]) -> dict[str, Any]

Release source · Runtime guarantees · Capability guides

from cayu import TextEmbeddingResult

Provider-neutral embedding response.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
model str required
embeddings list[TextEmbedding] required
usage TextEmbeddingUsage | None None
metadata dict[str, Any] Field(default_factory=dict)
TextEmbeddingResult.validate_model(value: str, info) -> str
TextEmbeddingResult.copy_embeddings(value: list[TextEmbedding]) -> list[TextEmbedding]
TextEmbeddingResult.copy_usage(value: TextEmbeddingUsage | None) -> TextEmbeddingUsage | None
TextEmbeddingResult.copy_metadata(value: dict[str, Any]) -> dict[str, Any]
TextEmbeddingResult.validate_embeddings() -> TextEmbeddingResult

Release source · Runtime guarantees · Capability guides

from cayu import TextEmbeddingUsage

Provider-reported token usage for an embedding request when available.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
input_tokens int | None Field(default=None, ge=0)
total_tokens int | None Field(default=None, ge=0)
metadata dict[str, Any] Field(default_factory=dict)
TextEmbeddingUsage.validate_token_count(value: int | None, info) -> int | None
TextEmbeddingUsage.copy_metadata(value: dict[str, Any]) -> dict[str, Any]

Release source · Runtime guarantees · Capability guides