Skip to content

cayu.memory.retrieval

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 FusedChannelMatch

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
channel str required
index_version str required
rank int required
representation str required
content_hash str required
explanations tuple[str, ...] required
raw_score float | None required

Release source · Runtime guarantees · Capability guides

from cayu.memory import FusedRetrievalCandidate

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
identity RetrievalCandidateIdentity required
score float required
reciprocal_rank_score float required
feature_adjustment float required
features Mapping[str, float] required
best_rank int required
channel_count int required
matches tuple[FusedChannelMatch, ...] required
FusedRetrievalCandidate.validate_features(value) -> dict[str, float]
FusedRetrievalCandidate.freeze_features(value: Mapping[str, float]) -> Mapping[str, float]
FusedRetrievalCandidate.serialize_features(value: Mapping[str, float]) -> dict[str, float]

Release source · Runtime guarantees · Capability guides

from cayu.memory import RankedRetrievalChannel

Bounded, independently ranked output from one retrieval channel.

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
channel str required
index_version str required
candidate_limit int required
hits tuple[RankedRetrievalHit, ...] ()
truncated bool False
continuation str | None None
RankedRetrievalChannel.validate_identity_fields(value: str, info) -> str
RankedRetrievalChannel.validate_candidate_limit(value) -> int
RankedRetrievalChannel.validate_truncated(value) -> bool
RankedRetrievalChannel.validate_continuation(value: str | None) -> str | None
RankedRetrievalChannel.validate_bounded_ranking() -> RankedRetrievalChannel

Release source · Runtime guarantees · Capability guides

from cayu.memory import RankedRetrievalHit

One bounded channel hit; raw scores are diagnostic and never fused.

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
identity RetrievalCandidateIdentity required
rank int required
representation str required
content_hash str required
explanations tuple[str, ...] ()
raw_score float | None None
features Mapping[str, float] Field(default_factory=dict)
continuation str | None None
RankedRetrievalHit.validate_rank(value) -> int
RankedRetrievalHit.validate_identity_fields(value: str, info) -> str
RankedRetrievalHit.validate_explanations(value) -> tuple[str, ...]
RankedRetrievalHit.validate_raw_score(value) -> float | None
RankedRetrievalHit.validate_features(value) -> dict[str, float]
RankedRetrievalHit.freeze_features(value: Mapping[str, float]) -> Mapping[str, float]
RankedRetrievalHit.serialize_features(value: Mapping[str, float]) -> dict[str, float]
RankedRetrievalHit.validate_continuation(value: str | None) -> str | None

Release source · Runtime guarantees · Capability guides

from cayu import RetrievalCandidateIdentity

Exact typed canonical revision identity shared by retrieval channels.

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
record_type str required
record_id str required
revision str required
RetrievalCandidateIdentity.validate_identity(value: str, info) -> str
RetrievalCandidateIdentity.sort_key() -> tuple[str, str, str]

Release source · Runtime guarantees · Capability guides

from cayu.memory import RetrievalChannelDiagnostics

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
channel str required
index_version str required
candidate_limit int required
hit_count int required
unique_candidate_count int required
truncated bool required
continuation_available bool required

Release source · Runtime guarantees · Capability guides

from cayu.memory import RetrievalFusionDiagnostics

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
strategy_version str required
configuration_version str required
configuration_sha256 str required
channels tuple[RetrievalChannelDiagnostics, ...] required
unique_candidate_count int required
returned_candidate_count int required
omitted_candidate_count int required
truncated bool required
truncation_reasons tuple[str, ...] required
continuation_channels tuple[str, ...] required

Release source · Runtime guarantees · Capability guides

from cayu.memory import RetrievalFusionResult

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
candidates tuple[FusedRetrievalCandidate, ...] required
diagnostics RetrievalFusionDiagnostics required

Release source · Runtime guarantees · Capability guides

from cayu.memory import WEIGHTED_RECIPROCAL_RANK_FUSION_VERSION
WEIGHTED_RECIPROCAL_RANK_FUSION_VERSION = 'cayu.wrrf.v1'

Release source · Runtime guarantees · Capability guides

from cayu.memory import WeightedReciprocalRankFusion

Deterministic weighted reciprocal-rank fusion reference strategy.

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
strategy_version class attribute WEIGHTED_RECIPROCAL_RANK_FUSION_VERSION
WeightedReciprocalRankFusion.fuse(channels: tuple[RankedRetrievalChannel, ...], config: WeightedReciprocalRankFusionConfig) -> RetrievalFusionResult

Release source · Runtime guarantees · Capability guides

from cayu.memory import WeightedReciprocalRankFusionConfig

Versioned, evaluation-owned WRRF weights and hard work budgets.

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
configuration_version str required
channel_weights Mapping[str, float] required
rrf_k float 60.0
feature_weights Mapping[str, float] Field(default_factory=dict)
max_candidates_per_channel int 100
fused_head_limit int 50
strategy_version str WEIGHTED_RECIPROCAL_RANK_FUSION_VERSION
WeightedReciprocalRankFusionConfig.validate_versions(value: str, info) -> str
WeightedReciprocalRankFusionConfig.validate_channel_weights(value) -> dict[str, float]
WeightedReciprocalRankFusionConfig.validate_feature_weights(value) -> dict[str, float]
WeightedReciprocalRankFusionConfig.freeze_weight_maps(value: Mapping[str, float]) -> Mapping[str, float]
WeightedReciprocalRankFusionConfig.serialize_weight_maps(value: Mapping[str, float]) -> dict[str, float]
WeightedReciprocalRankFusionConfig.validate_rrf_k(value) -> float
WeightedReciprocalRankFusionConfig.validate_limits(value, info) -> int
WeightedReciprocalRankFusionConfig.validate_enabled_channels() -> WeightedReciprocalRankFusionConfig
WeightedReciprocalRankFusionConfig.model_copy(*, update: Mapping[str, Any] | None=None, deep: bool=False) -> Self

Return an independently validated immutable configuration.

WeightedReciprocalRankFusionConfig.fingerprint() -> str

Release source · Runtime guarantees · Capability guides